
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using variable in SET analysis
Hi all,
I have a very basic doubt on using variable in SET analysis in Qliksense.
In table i have have three columns, as shown below:
eventdate | month | amount |
31-05-2016 | 2016_5 | 2 |
31-05-2016 | 2016_5 | 3 |
31-05-2016 | 2016_5 | 16 |
31-05-2016 | 2016_5 | 21 |
31-05-2016 | 2016_5 | 22 |
31-05-2016 | 2016_5 | 25 |
31-05-2016 | 2016_5 | 34 |
31-05-2016 | 2016_5 | 38 |
31-05-2016 | 2016_5 | 48 |
I want to calculate sum of amount for last month (2016_5).
Now for this,
I am creating a variable which is year_month.
In script i created this variable as:
set vmonth_1=(year(today()))&'_'&(month(today())-1);
Now, i am writing set analysis for this:
sum({<month={'$(=vmonth_1)'}>} amount)
but this statement doesn't seem to work and result shows as "-". I am really confused with this, appreciated if anyone can help me on this.
Thanks
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try
LET vmonth_1=(year(today()))&'_'&(month(today())-1);
Now your variable should hold 2016_5
Then:
sum({<month={'$(vmonth_1)'}>} amount)
edit: Please note that your variable will probably not create the correct value in January.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try
LET vmonth_1=(year(today()))&'_'&(month(today())-1);
Now your variable should hold 2016_5
Then:
sum({<month={'$(vmonth_1)'}>} amount)
edit: Please note that your variable will probably not create the correct value in January.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oh yes!
Thanks!
