16 Replies Latest reply: Jun 8, 2012 12:21 AM by Ashutosh Paliwal

# If statement and set analysis togather

Can we use If statement and Set analysis togather???

• ###### Re: If statement and set analysis togather

Yes, you can and there are scenarios where this is a usual setting.

edit: I assumed you mean using if() and set analysis within an aggregation function...

• ###### If statement and set analysis togather

please can you give me any example on that ehere therre is a combination of if and set analysis......its very imp to know me.....

• ###### If statement and set analysis togather

yea we can like below

sum({<Year={'2010'}>}  if(Month='Jan' ,Sales))

hope this helps

• ###### If statement and set analysis togather

hi sunil

are you sure the expression you used is correct???

• ###### If statement and set analysis togather

please  can you send me any type of sample application in which such type of condition is working???

• ###### Re: If statement and set analysis togather

yes you can see the example application

see the attached file

see expression of bar charts

hope this helps

• ###### If statement and set analysis togather

Thanks for sending me that sample.......

• ###### If statement and set analysis togather

Hi sunil,

In your example you successfully implemented set analysis with 1 if statement.... but is it possible to implement nested if condition in set analysis? I tried it in your example but it is not working .....can you give me some information on this???

yojas

• ###### Re: If statement and set analysis togather

yes we can do like below

sum(if(Year=2012,if(product='a',sale))

• ###### Re: If statement and set analysis togather

Hi,

But your Example is purly based on if(...) condition and not on the basis of nested if condition as well as set analysis.... can you send me any examples based on set analysis and multiple if conditions  ?

yojas

• ###### If statement and set analysis togather

its nested if

• ###### Re: If statement and set analysis togather

yes it is nested if but without set analysis...... i want it with set analysis.....

• ###### Re: If statement and set analysis togather

Hi,

Sunil has a valid point.

Set analysis and Nested If can be used together.

Please find the attchaed app and see in chart how both are used together.

..

Ashutosh

• ###### If statement and set analysis togather

This does not work for me.

=Sum({<BandwidthandCircuit={'BandwidthandCircuit'}>}IF(sum(InBandwidth)+sum(OutBandwidth)=0,0,

IF(sum(InBandwidth)=0,sum(OutBandwidth/OutBandwidth) * 100,

IF(sum(OutBandwidth),(sum(In_Averagebps)/sum(InBandwidth)) * 100,

sum(Out_Averagebps/OutBandwidth)+sum(In_Averagebps/InBandwidth)*50))))

• ###### If statement and set analysis togather

Hi Alex Peasley,

Basic aggregation functions can not be nested.

But, if You want to then you have to use advanced aggregation function. So, using aggr() will help you out.

To see how to use aggr(), search in community or in Qlikview manual/help also you will find details.

..

Ashutosh

• ###### If statement and set analysis togather

see the below code

sum({<Year={'2012'}>} if(product='a',if(category=1,sale)))

nested if with set analysis.

hope this helps