Error while adding calculated field in a view

Trying to create this calculation
ifelse(
{Date Month} = 2,
COALESCE({Actual Revenue CY}, 0) - COALESCE({Actual Revenue PY}, 0),
NULL
)

It gets created but upon pulling it to a visual, I am getting an error.

Hi @Hunny ,

I tried the same and it worked for me. Could you please tell if datamonth is integer or string and if the two fields (Actual Revenue Cy, Actual Revenue PY) are aggregated?

1 Like

datemonth is integer and the other two fields are not aggregated.

ifelse({Date Month} = 1,
{Actual Revenue CY} - {Actual Revenue PY},
NULL)
also gives error

Hello @Hunny, are you still having issues running this calculation? Also, are Actual Revenue CY and Actual Revenue PY calculated fields or are you pulling them directly from the dataset? My initial thought is that it is upset with the Date Month = 2 part of the calculation. I don’t know why it wouldn’t throw the error within the calculated field itself, but you can try comparing it to a string rather than an integer.

ifelse(
{Date Month} = "2",
COALESCE({Actual Revenue CY}, 0) - COALESCE({Actual Revenue PY}, 0),
NULL
)

Let me know if that helps!

Hello @Hunny, since we have not heard back from you with any follow-up questions, I will close out this topic. If you still need assistance with this, please post a new question in the community and include a link to this topic to provide relevant information. That will ensure you are at the top of the priority list for a response from one of our QuickSight experts. Thank you!