Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to pass if condition inside a set analysis expression. Below is my expression that is not working.
In the below example I used 0=0 and 1=1 for variable place holder.
sum({<if(0=0, countryflag={1}, countryflag={2}),
if(1=1, userflag={1},'')>}sales)
it is giving error in set modifier expression. Please help.
should be represented as string in single quotes
var1=if(0=0, 'countryflag={1}, countryflag={2}');
var2=if(1=1, 'userflag={1}','');
then
count({<$(=var1),$(=var2)>} sales)
Hi Vineeth,
Thank you for your reply . Actually this works
var1=if(0=0, 'countryflag={1}', 'countryflag={2}');
If you want to have a different expression based on dimension value then place your expression inside an if() block
=If(Dim=1,
sum({<countryflag={1}, countryflag={2}>}sales)
,If(Dim=0,sum({<Userflag={1}>}sales)))
Hi Vineeth,
Thank you for your reply. I want to place if condition inside set analysis syntax, reason being I want to pass variable in side it.
For example,
var1=if(0=0, countryflag={1}, countryflag={2});
var2=if(1=1, userflag={1},'');
Finally it would go inside set expression
count({<$(var1),$(var2)>} sales)
should be represented as string in single quotes
var1=if(0=0, 'countryflag={1}, countryflag={2}');
var2=if(1=1, 'userflag={1}','');
then
count({<$(=var1),$(=var2)>} sales)
Hi Vineeth,
Thank you for your reply . Actually this works
var1=if(0=0, 'countryflag={1}', 'countryflag={2}');
yes, because it needs to be expressed as a string which would then be evaluated during the $() expansion
I assumed this was one string 'countryflag={1}, countryflag={2}'
Thank you for your reply. 😁
kindly close the thread by marking a response as solution