Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sony
Contributor II
Contributor II

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

1 Solution

Accepted Solutions
BenjaminT
Partner - Creator
Partner - Creator

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

View solution in original post

2 Replies
BenjaminT
Partner - Creator
Partner - Creator

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

wcoleman0908
Partner - Contributor III
Partner - Contributor III

I believe the request was to set a variable  value based on the filter selection.