Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

if clause in a variable

Howdy!  In short, I want bring in a different month for  the measure  defined in my if statement in my variable.

my expression is the following  Sum({<MonthNum={$(=(vMonth_adj))}>}  $(cost_adjusted))/

my month variable vMonth_adjusted  is defined as  if(Measure= 'WSK var cost',  Concat(DISTINCT [MonthNum], ',')+1,  Concat(DISTINCT [MonthNum], ',') )

apparentl tihs expression does not work? I would appreciate your help.

(Meanwhile when vMonth is defined as  =Concat(DISTINCT [MonthNum], ',')    it works fine!)


3 Replies
pradosh_thakur
Master II
Master II

may be

if(Measure= 'WSK var cost',  Concat(DISTINCT [MonthNum] +1 , ','), Concat(DISTINCT [MonthNum], ',') )

Learning never stops.
Anil_Babu_Samineni

Can you show image of this?

if(Measure= 'WSK var cost',  Concat(DISTINCT [MonthNum], ','))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
marcus_sommer

This part: if(Measure= 'WSK var cost' within your variable won't be evaluated on row-level because it is part of an adhoc-variable which will be evaluated global before the chart is calculated and applied on each row. Quite probably there are more han one value for Measure available and without an aggregation on the field it will return NULL.

Further concat() will return a string if more than one MonthNum is available and adding with 1 will also return NULL. What is the aim for + 1?

- Marcus