Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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], ','))

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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