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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Multiple conditions in set analysis expression

Hi,

I would like to present my sales statistics in a straight table the past 12 months...

Which is the best way to do that using set analysis??

I have this year as a default selection in my document.

sum({$<MyYear={$(=Only(MyYear)), $(=Only(MyYear)-1)}>} MyAmount)

This code gives me this year's (2013) sales + the sales of the whole 2012... I only want november and december from 2012, or even better, the sales from 5/11/2012 as that is on the day correct...
Any thoughts about this?

Thanks in advance.

Best regards,

Filip

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That sounds like you have a Year field and selected 2013. In that case you need to change the set modifier so the selection in the Year field is ignored. Try sum({$<Year=, MyDate={'>$(=addyears(today(),-1))'}>} MyAmount)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
jvitantonio
Specialist III
Specialist III

Hi, Try this:

=sum({<MyDate= {"<=today(), >=today()-365"}>} [MyAmount])

MyDate is a field containing the date.

JV

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Assuming you have a date field try: sum({$<MyDate={'>$(=addyears(today(),-1))'}>} MyAmount).


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thank you for your posts, but unfortunately none of these examples helps me..

I've read a lot of possible solutions, but just can't get it work...

Any other suggestions?

Anonymous
Not applicable
Author

I really think this should work.

But I am only getting the values from this year... I have data with invoice date '2012-12-10' for example, but I won't reach it for some reason....

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That sounds like you have a Year field and selected 2013. In that case you need to change the set modifier so the selection in the Year field is ignored. Try sum({$<Year=, MyDate={'>$(=addyears(today(),-1))'}>} MyAmount)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thank you a lot, that was what I was looking for!