Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between IF condition and Set analysis

Hi All,

    I see different results if I calculate the same expression suing "Set analysis" and :If condition"

For Eg:

IF condition =sum( If(Year=vMaxyear,sales))

Set analysis = sum({< Year={'S(vMaxyear)'}>} Sales)

Can someone tell me the reason for the same..

Thanks in advance..

6 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi,

Set Analysis Give Unique Value ,and Reduce Memory

but if Condition Some times return  Duplicate  value  and consume more memory.

Regards

Perumal A

lironbaram
Partner - Master III
Partner - Master III

well

set analysis is like making  a selection in the model , but the selection is made only in the calculation of the formula

i.e. the vMaxYear will have the one value to all the calulations of the expression

if statement is calculating each row against the vMaxYear,

it seems it should be the same in both cases

what is the expression of the variable

Not applicable
Author

Hi liron,

      My VMaxyear = Max(Total Year)..

I think in this case i should get the same values...

But dnt understanding why the results  are different..

Not applicable
Author

Ideally both are similar in the context you are using… Unless there is data issues (generally it happens in case of Date, where date is captured in Date and Numeric Format both), set analysis needs correct formatting of variables.

I am different opinion from Perumal, as if statement used correctly are less memory intensive, then set analysis…

Ideally, I will look at expression of variable and also look at the data for some anamolies

Regards

lironbaram
Partner - Master III
Partner - Master III

can you post an example

Not applicable
Author

Hi Kulbir

I have a field called Process date out of which the Date field is being calculated..

The process date is in the time stamp format.. Would this be a problem???I have pulled only DD/MM/YYYY out of the Process date and created the DATE field...

Thanks