Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If and set analysis

Hi everyone

I am having problems excluding selections when using if together with a set analysis like this

if(_sys_flag_Dag <> 'Igår',

     sum({1<$(sFilterToday)>} [InqueriesCount]),

          sum({1<$(sFilterYD)>} [InqueriesCount])

)

Note the 1's that should include all data!

The expression works well if I don't do any selections but when I select something in the app only that selection displays in the graph (the 1's should prevent this). When I run the expressions one by one (removing the if statement) the selections does not affect the expression!

Any ideas?

Many thanks!

/Mats

5 Replies
jvitantonio
Luminary Alumni
Luminary Alumni

What's the field you want to exclude? Fro instance, if you want ot exclude the field called "Date" then you should do it like this:

  sum({1<Date=,$(sFilterToday)>} [InqueriesCount]),

Miguel_Angel_Baeyens

Hi Mats,

What about something like this instead?

sum(if(_sys_flag_Dag <> 'Igår', '{1<$(sFilterToday)>}', '{1<$(sFilterYD)>}') [InqueriesCount]))

You may need to store the whole If() into a variable so it is always evaluated just once and not for each value of the dimension.

Hope that helps.

Miguel

Not applicable
Author

Hi

Even when I write {<Date=, etc it still does exclude my selections .. even if this worked it would not be a possible solution since I have too many fields in my application

BR

/Mats

Not applicable
Author

Hi Miguel

I have been pondering this a bit and it seems like Qlikview is selecting the data for the if statement and thus overriding the 1 figure in the set analysis.

I do not know if this is solvable and what I will do is to probably make two graphs on top of each other with one expression each and will then swap between these graphs instead.

Many thanks!

/Mats

jonathandienst
Partner - Champion III
Partner - Champion III

Mats

Perhaps the selections are affecting/limiting the value of your field/variable _sys_flag_Dag possibly indirectly?

There is no reason that I am aware of the limits you from putting a set expression in an If statement. I do that frequently.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein