Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have this Set Analysis but it is not working because the if condition is not working and always executing the else section. The problem seems to me is, the if condition is returning multiple values therefore, the true condition is not executed and directed to execute else block of code.
How to fix this thing ?
=if(Month(Date) = month(today()-1) and Year(Date) = year(today()-1),
sum({<field={0}>}field1), sum({<field={0}>}field2))
Thanks
You could try using a more pure set analysis approach to solve this.
Something like this:
sum({<field = {0}, Date = {">=$(=MonthStart(Today(), -1)) <=$(=MonthEnd(Today(), -1))"}>} field1)
+
sum({<field = {0}, Date -= {">='$(=MonthStart(Today(), -1))' <='$(=MonthEnd(Today(), -1))'"}>} field2)
Are you using this condition in KPI or table object?
Do you have a date that is corresponding to the yesterday?
What selections are you making in the filters?
It seems your date may not be evaluating correctly against the specified conditions. Try checking each condition separately to see what result it produces.
You could try using a more pure set analysis approach to solve this.
Something like this:
sum({<field = {0}, Date = {">=$(=MonthStart(Today(), -1)) <=$(=MonthEnd(Today(), -1))"}>} field1)
+
sum({<field = {0}, Date -= {">='$(=MonthStart(Today(), -1))' <='$(=MonthEnd(Today(), -1))'"}>} field2)