Syntax Errors in Calculated Fields

Keep running into syntax errors trying to create a calculated field. I’m trying to pull one value at the project intersect. I’m using this is the calculated expression:

max(amount,[project])

What am I doing wrong?

Hi @Edward_Appiah – I tried setting the calculated field for max with a sample data set. It worked as expected. Please see screenshot below. Please check the data type of “amount” data column. For Max function to work, “amount” should be a measure.

1 Like

Thank you awsvig, I amusing a measure but now I get another error syntax error

1 Like

Hi @Edward_Appiah,

The issue is with your capex amount field. If QuickSight recognizes it as a field in your dataset/analysis, it should display it in that orange color. Can you check the spelling of the field name?

1 Like

Thank you David. When capex amount is orange. I get an error that says I have too many arguments.

@Edward_Appiah,

You need square brackets around project code.

 max({capex amount}, [project_code])
1 Like

@David_Wong received the same error

@Edward_Appiah,

What is the specific error message this time? Does it still say too many arguments? The syntax looks correct to me, so it must be some other error.

1 Like

@David_Wong The error says “Function MAX should have one 1 argument (s) instead of 2 arguments.”

@Edward_Appiah,

I think it’s because you’re using this syntax in a dataset. It only works at the analysis level. When used in your analysis, it calculates the sum of capex amount grouped by project_code. Can you created the calculated field in your analysis instead?

1 Like

Hi @Edward_Appiah

It’s been a while since we last heard from you. If you have any further questions, please let us know how we can assist you.

If we don’t hear back within the next 3 business days, we’ll proceed with close/archive this topic.

Thank you!

Hi @Edward_Appiah

Since we have not heard back from you, I’ll go ahead and close/archive this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for relevant information.

Thank you!