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: 
Not applicable

How to insert IF statement in a set analysis?

I want to create a set analysis that would select a subset of values only if a particular condition is verified but, it seems not possible to insert an if into { }.

8 Replies
Gysbert_Wassenaar

Can you explain what you're actually trying to do? Preferable with an example with source data and the result data you expect.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

vikasmahajan

SUM(AGGR(if(((max({$<[Expiration Date]-={'01/01/1753'}>}[Expiration Date]) - vDateForAgeing >=1

and  max({$<[Expiration Date]-={'01/01/1753'}>}[Expiration Date]) - vDateForAgeing <= 30) ),SUM(Inv_Val)),Location_Code, Item_Code))/100000

This way you can use if in set analysis

HTH

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

We wont to have somenthing like this:

Date is our date dd.mm.yyyy

Day is our day column

Jobs is what we wont nullcount

we wont write something like this:

=NULLCOUNT ({<Date = { <= '(if ( Date ='Monday' ,date(Date - 3), if( Day='Sunday', date(date-2), date(Date-1))))'}>} Jobs)

I want specify that if statement is correct because we tested it.

Gysbert_Wassenaar

A set analysis expression calculates a set at the chart level, not at row level. That's why you cannot use a set analysis expression. You need to use an if statement.


talk is cheap, supply exceeds demand
krishna20
Specialist II
Specialist II

Hi,

If you wanna check the condition between two fields the following one will works.

=((if((CLM_STATUS <>'C' or (CLM_STATUS='C' ),

(sum({<CE_EST_TYPE={"=CE_EST_TYPE=1"},CE_DT={"=CE_DT<=Today()"},

CLM_SOURCE_FM={"=CLM_SOURCE_FM=CE_SOURCE_FM"},

CLM_COMP_CODE={"=len(trim(CLM_COMP_CODE))>0"}>}CE_AMT_LC_1)

Regards

Krishna

Not applicable
Author

how would you write this?

we try also with only if statement but it doesn't work too.

=if(Date<=(if ( Day='Monday' ,date(Date - 3),

if(Day='Sunday', date(Date-2), date(Date-1)))),NullCount(Jobs))

krishna20
Specialist II
Specialist II

Hi ,

can you please post actual fields you have.I'm not getting to which date field you are comparing with.

Regards

Krishna