Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Joda
Partner - Contributor II
Partner - Contributor II

Depending on an if-condition, data is selected or no data is selected

Hello everyone,

I would like to use an if-condition in a variable to calculate, if i need set analysis or not. So the set analysis is supposed to include a field selection or there is no field selection at all, depending on the if-condition in the variable.

Here is my calculation in the chart:

=sum({<Week={"=$(=vWeek)"}>} SomeField)

The variable in that sum is defined as follows:    vWeek  =if(GetSelectedCount(Week)>0, max(Week), '*')

But everytime QlikView interprets the * as some text and does not show anything at all, because the field Week includes values from 1 to 52.

 

Thank you for your answer 🙂
Joda

1 Solution

Accepted Solutions
bharathadde
Creator II
Creator II

Try this 

vWeek =if(GetSelectedCount(Week)>0, max(Week) , Concat(distinct Week,chr(39) & ',' & chr(39)) )

Calculation

=Sum({<Week={'$(=vWeek)'}>} Sales)

View solution in original post

5 Replies
carahyba
Partner - Contributor III
Partner - Contributor III

bharathadde
Creator II
Creator II

Try this 

vWeek =if(GetSelectedCount(Week)>0, max(Week) , Concat(distinct Week,chr(39) & ',' & chr(39)) )

Calculation

=Sum({<Week={'$(=vWeek)'}>} Sales)

Joda
Partner - Contributor II
Partner - Contributor II
Author

Hello Bharathadde,

Thanks for your reply 🙂

It works!!

 

Joda
Partner - Contributor II
Partner - Contributor II
Author

Hello Carahyba,

Thanks for your reply!

I read the replies in that thread and it turns out that they come up with the same solution, provided by Bharathadde.

ViktoriyaParshin
Contributor
Contributor

Hello,

Maybe, somebody faced this problem and could help me :-).

I created the calculated column. After the receiving the results, I need remove "Null"s

"Expressions" returns me the correct results, but impossible remove Null values in model

Calculated dimension, where Null remove is possible, - presents not correct results .

my calculation is:

=if (T_Number = Max_T_Number or (IsNull (T_Number) and Qty_On_Hand > 0.1 ), 'New', Null())

NumberT_NumberMax_T_NumberExpressionsCalculated dimensionQty_On_Hand
ABC1  New 1
ABC2T119565T119566NewNew 
ABC3  New 1
ABC4T119568T119568NewNew 
ABC5     

 

 

thank you!