Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: How to insert IF statement in a set analysis?

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
qlikview0585
New Contributor

Re: How to insert IF statement in a set analysis?

vikasmahajan
Honored Contributor III

Re: How to insert IF statement in a set analysis?

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

Not applicable

Re: How to insert IF statement in a set analysis?

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.

Re: How to insert IF statement in a set analysis?

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
Valued Contributor

Re: How to insert IF statement in a set analysis?

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

Re: How to insert IF statement in a set analysis?

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
Valued Contributor

Re: How to insert IF statement in a set analysis?

Hi ,

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

Regards

Krishna

Community Browser