Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Creator II
Creator II

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

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

4 Replies
Highlighted
Partner
Partner

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

Highlighted
Creator II
Creator II

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

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

Highlighted
Partner
Partner

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

Hello Bharathadde,

Thanks for your reply 🙂

It works!!

 

Highlighted
Partner
Partner

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

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.