
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to dynamically assign a variable based on filter selection
Hi Team, I'm new to QlikSense. I have a filter pane of Months from January to December. I want to assign the variable value based on filter selection.
If February is selection in the filter pane, the variable value should be assigned to its previous month i.e., January.
How to write the expression for above described variable. Can anyone please help me?
Thank you
- Subscribe by Topic:
-
Chart
-
Developers
-
dimension
-
expression
-
filter
-
General Question
-
Set Analysis
-
Variables
-
Visualization
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you need this to work when only a single Month is selected, something like the following should work:
=date(addmonths(date(date#(only(Month), 'MMMM')),-1), 'MMMM')
This is assuming that your [Month] field is jus a text string
Hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you need this to work when only a single Month is selected, something like the following should work:
=date(addmonths(date(date#(only(Month), 'MMMM')),-1), 'MMMM')
This is assuming that your [Month] field is jus a text string
Hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe the request was to set a variable value based on the filter selection.
