Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Partner
Partner

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
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
Partner
Partner

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

Partner
Partner

Hello Bharathadde,

Thanks for your reply 🙂

It works!!

 

Partner
Partner

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.

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!