I am trying to use an if statement with a variable in my expression and I get no results. The variable works when I use the variable on it's own but when used with the if I get no results.
I have tried:
Nothing seems to work. Thanks
Solved! Go to Solution.
I see whats happening, you don't have a dimensión, so the if() always returns null() because each row has all quarternumbers, usually to add filters other than dimensions you need to use set analysis, wich will broke the use you are doing of variables, or you will need to pass the quarter as parameter
One quick fix can be adding an aggr to the expression, so each row will virtually check the quarters one by one:
The variable content is =Sum([Unit Cost PO])/Count([Unit Cost PO])
Also if(OrderQtr='Apr-Jun 2018',1,0)" did not return 1 in the expected quarter