Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

lweny
New Contributor

Get a value from selected value in filter pane

Anyone know how to get a value from filter pane? For example in "Year" filter pane user choose 2018, then I need to use this value in the expression. Thanks a bunch!
1 Solution

Accepted Solutions
MVP
MVP

Re: Get a value from selected value in filter pane

GetFieldSelections(Year) will return a list of years if the user selects more than one, and will return nothing of nothing is selected. This behaviour may be what you want.

An alternative is to use =Max(Year). This will always return exactly one value. If the user selects a year, this will return the selected year. If no selections are made, it will return the latest year in the data set. If the user selects more than one year, then this expression will return the maximum of the selected years. T

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
6 Replies
Highlighted
shiveshsingh
Honored Contributor

Re: Get a value from selected value in filter pane

Hi, Use this.

 

=GetFieldSelections(Year)

MVP
MVP

Re: Get a value from selected value in filter pane

GetFieldSelections(Year) will return a list of years if the user selects more than one, and will return nothing of nothing is selected. This behaviour may be what you want.

An alternative is to use =Max(Year). This will always return exactly one value. If the user selects a year, this will return the selected year. If no selections are made, it will return the latest year in the data set. If the user selects more than one year, then this expression will return the maximum of the selected years. T

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
lweny
New Contributor

Re: Get a value from selected value in filter pane

@shiveshsingh Thanks for reply! I tried your solution in my expression but got an error sum({<[Year]={GetFieldSelections(Year)}, [Type]={"*Forecast"}>}[Sales], did I make a mistake here?

shiveshsingh
Honored Contributor

Re: Get a value from selected value in filter pane

Try this

=sum({<[Year]={"$(=GetFieldSelections(Year))"}, [Type]={"*Forecast"}>}[Sales])

lweny
New Contributor

Re: Get a value from selected value in filter pane

@jontydkpi thanks for the solution, it works for me, cool! thanks so much

lweny
New Contributor

Re: Get a value from selected value in filter pane

yes, this format works, sometimes I got confused with the brackets, they are so many! anyway, thanks for your help shiveshsingh