Simple IfElse For Value >0

I feel like I’ve tried every permutation of syntax here. I want a field that says “Good” if the “Sales” Field is non zero. What is wrong with the below?

ifelse({Total Sales}>0, ‘Good’, NULL)

Hi @cactus - What is the data type of the filed Total Sales? and also please share the error screen shot for understanding the error details.

Regards - Sanjeeb

1 Like

I tried the same and it works
ifelse(Sales>200, ‘Good’, NULL)

One issue I can think of is… All data returned then and else expressions must be of the same data type or be converted to the same data type.

May be you can share screenshot to see the error

2 Likes

The formula for the 25th percentile of sales is partioned on the report date of my data.

percentileDisc({total sales},25,[{Report Date}])

Sales value is not aggregated but percentileDisc is aggregated. They are on different level of data granularity. Therefore, it shows the error message.
You may use table calculation functions percentileDiscOver which pre-aggregate the data before doing the comparison in this case.

ifelse({total sales} > percentileDiscOver({total sales},25,[{Report Date}],PRE_AGG),
“Less than 25 percentile”,NULL)

1 Like