
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Variables in set analysis
Hi all,
I´m making a new dashboard in Qlik.
My bussiness are related with incidences, so, count(NumberIncidences) will be usual to use...
Anyway, I´m trying to use variables in a simple set analysis.
Here my var:
nameVar: vCurrentMonth
expression of var: vCurrentMonth = Month(Today())
Y would like to know my incidences in a current month with set analysis, i would like to know this month, next month, etc.
I would like to have this information instanly, without filters applied. So:
Here my set analysis expression:
=count({<MONTH={'=$(vCurrentMonth)"}>}NumberIncidences)
I´m totally deseperate, because I tested to get and represent the value of my variable typing the next:
=$(vcurrentMonth)
and the result is 3. that´s perfect!, but when i try to put in a setAnalysis Expression...EXPLOIT! never work!
any help or manual or whatever will be very very helpful!
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be this
=Count({<MONTH = {"$(=$(vCurrentMonth))"}>} NumberIncidences)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your answer, but it doesn´t work.
I´ve already tried it and still not working.
is there any document, procedure to type or debug setAnaysis expressions??
how is possible something that is really easy does no works ?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using double quotes in the set analysis for the variable. Additionally, if you're not evaluated your variable in the definition (LET/SET), you'll need to do it in the expression as well:
Try this:
=Count({<MONTH = {"=$(vCurrentMonth)"}>} NumberIncidences)
=Count({<MONTH = {"=$(=$(vCurrentMonth))"}>} NumberIncidences)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set analysis get tricky with variables, you can check these threads to understand dates within set analysis better


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi juancarlos.diago,
first of all, I believe Month(Today()) is returning you 'March' instead of '3'. You are probably visualizing the variable with 'number format'. That being said, see my below comments.
If you'd like to set a unique month to your expression, you can use single quote assignment in your set analysis.
If you'd like to set another relational operation to your expression (e.g., >=, <=, etc), you can use double quotes instead.
// In script
LET vCurrentMonth = Month(Today()); // March
LET vCurrentMonthNum = Num(Month(Today())); // 3
// In KPI
Count({<Month={'$(vCurrentMonthNum)'}>}NumberIncidences) // Number of incidences in March - single quoted
Count({<Month={">=$(vCurrentMonthNum)"}>}NumberIncidences) // Number of incidences in March or later - double quoted
Hope this helps
Regards!
Edit: Did this solve the problem?
