Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis : using conditions

Hi !

I noticed that sometimes

[CODE]
=sum({$<Year=,Month=>} if(Year=$(=Year) and Month=$(=Month), [MyField]))
[/CODE]

doesn't give the same result than

[CODE]
=sum({$} [MyField])
[/CODE]

where "Year" and "Month" are in the selection.

I would like to know how I can use complex conditions in the set analysis statement.

I would like to use a "lower than" and "greater than" and variables and functions.

For instance, I would like to say "only take the values where the date is between a specific date (the selection) and today".

Something like :

[CODE]
=sum({$<Year=,Month=,Day=,Date={">=" & makedate($(=Year), $(=Month), $(=Day)) & "<=" today()}> [MyField])
[/CODE]

Unfortunately, the usage of "&" for the concatenation doesn't seems to work, neither the usage of a function like "makedate" 😞

Even when I set hard values, it doesn't work :

[CODE]
=sum({$<Year=,Month=,Day=,Date={">2008-01-01<2010-01-01"}> [MyField])
[/CODE]

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

here are an example for a date range.

Good luck!

Rainer

View solution in original post

2 Replies
Not applicable
Author

Hi,

here are an example for a date range.

Good luck!

Rainer

Not applicable
Author

The formula in your document is quite the same that the formula I used... but it works Indifferent

This makes me feel like crazy...

(big thank you Big Smile )