Error cause when creating analysis using API 'create-analysis'

I have created an analysis with a calculated field on ‘Values’ of ‘LineChartVisual’. I am creating a calculated field within an analysis.
I used ‘describe-analysis-definition’ to get a difinition and used that difinition to create it with ‘create-analysis’. When I ran “describe-analysis” on that analysis, I found that the creation was failing.
The error message, calculation field definition, and error location definition are listed below.
Please tell me the cause of the error and how to deal with it.

Error message:

"Status": "CREATE_FAILED",
"Errors": [
    {
        "Type": "INVALID_COLUMN_AGGREGATION",
        "Message": "Aggregation Function can not be null for Field '77615d67-9c95-4095-b6e5-4f87926904a5.1.1672985171189'",
        "ViolatedEntities": [
            {
                "Path": "sheet/b1b126d8-7dbb-436a-b6ec-cd70f1b7792b/visual/LK_170882f6-73be-4f62-a355-b880048de2b0/field/77615d67-9c95-4095-b6e5-4f87926904a5.1.1672985171189"
            }
        ]
    }
]

calculation field definition:

"CalculatedFields": [
    {
        "DataSetIdentifier": "standard-format-month-ALL",
        "Name": "CalculatedFields1",
        "Expression": "ifelse(\r\n${absence}='休職率',{#休職率},\r\n${absence}='休職休業率',{#休職休業率},\r\nnull\r\n)"
    },
    ...

error location definition:

"Values": [
    {
        "NumericalMeasureField": {
            "FieldId": "77615d67-9c95-4095-b6e5-4f87926904a5.1.1672985171189",
            "Column": {
                "DataSetIdentifier": "standard-format-month-ALL",
                "ColumnName": "CalculatedFields1"
            },
            "FormatConfiguration": {
                "FormatConfiguration": {
                    "PercentageDisplayFormatConfiguration": {}
                }
            }
        }
    }
],

Hi @Natsuki - Did you create the analysis by API or you created from UI and trying to see the details from API. Please see the logic for calculated field, if there is any error, it will throw an error as well.

In parallel, can you provide the details on calculated field to ensure the logic written in calculated is correct. Please create the analysis first from UI for the testing. Then you can describe it from API.

Regards - Sanjeeb

1 Like

Hi.@Sanjeeb2022

Here are the steps:
(1) Create an analysis with the UI *There is no error in the time calculation field
(2) Get the “definition” of the analysis created in (1) with the API “describe-analysis-definition”
(3) Delete the unnecessary part of “definition” obtained in (2) (“AnalysisId”, “ResourceStatus”, etc.) *The content of the calculation field has not been changed
(4) Execute API “create-analysis” using “definition” formatted in (3)
(5) Run “describe-analysis” to check the execution result
→Error message: is returned.

Calculated field details.

"CalculatedFields": [
    {
        "DataSetIdentifier": "standard-format-month-ALL",
        "Name": "CalculatedFields1",
        "Expression": "ifelse(\r\n${absence}='休職率',{#休職率},\r\n${absence}='休職休業率',{#休職休業率},\r\nnull\r\n)"
    }

Thank you.

1 Like

Hi @Natsuki - Thanks for the details, I am not sure whether QS has create any issue with different language. Can you please raise a ticket to AWS Customer support team so that they can analyze this issue by screen share and provide you the right solution.

To raise the issue, please follow the link - Creating support cases and case management - AWS Support

Hi @Max @Ramon_Lopez @David_Wong - Any feedback on this.

Regards - Sanjeeb

Hi @Natsuki -

please replace ‘null’ at the end of your calculated field with a string value: ’ ’ or ’ - '. It seems that the NULL is throwing an error.
Let us know if this solves the issue you have.

Thanks,
GL

1 Like