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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Syntax for using a variable into Set Analysis

Hi,

Please can somebody explain the difference between the following two statements:

I tried to use a variable to calculate the previous months sales (based on MONTH Number.

However the following expression is bringing back ALL MONTHS before the current month....

sum({<CalendarMonthName =, CalendarMonthNumber = {'<= $(=v_Previous_Month)'}>} Sales)

So after trial and error this expression works........ (brings back only the previous month)

Sum({<CalendarMonthName=, CalendarMonthNumber={'$(v_Previous_Month)'}>} Sales)

Does anybody have an insight into the difference between the above expressions?

Labels (1)
1 Solution

Accepted Solutions
gandalfgray
Specialist II
Specialist II

In the first expression you have <= before the "previous month number".

That is like manually entering <= in the search box for a field - You will get all months less than or equal what you enter after the <=.

In the second expression you do not have anything before the "previous month number".

That is like manually entering just a month number in the search box for "month number" field - you will get that month.

View solution in original post

4 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

use this expression

Sum({<CalendarMonthName=, CalendarMonthNumber={'$(=v_Previous_Month)'}>} Sales)

Regards

Perumal

Not applicable
Author

Try with the following expression:

Sum({<CalendarMonthName=, CalendarMonthNumber={'$(=v_Previous_Month)'}>} Sales)

Or

Sum({<CalendarMonthName=, CalendarMonthNumber={"=$(v_Previous_Month)"}>} Sales)


Anonymous
Not applicable
Author

I think the question was stated badly ... (or has been mis-read)....

I found the solution but would like some explanation as to why the second expression works over the first one - which doesnt.

gandalfgray
Specialist II
Specialist II

In the first expression you have <= before the "previous month number".

That is like manually entering <= in the search box for a field - You will get all months less than or equal what you enter after the <=.

In the second expression you do not have anything before the "previous month number".

That is like manually entering just a month number in the search box for "month number" field - you will get that month.