Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Kaushik2020
Creator III
Creator III

How to pass Dynamic values in a Set Expression based on user selection in UI

There is a filter pane named CATEGORY with values Cat-1, Cat-2, Cat-3. 

~Apart from this I have Year, Month and Day filters. 

i want to display sum based on the field selected by user in the UI. below is how my set expression looks like. Please suggest on how i can pass field CATEGORY in the set expression dynamically based on user selection in UI.

 

Sum({$<Year=, Month=, Day=,CATEGORY= ,
Date={">=$(=date(monthstart(max(Date))))<=$(=date(max(Date)))"}>}
Count)

Labels (5)
5 Replies
udit_k
Partner - Creator II
Partner - Creator II

use expression as below :-

Below exp works on dynamic selection of User field.

sum({<USER={"$(=GetFieldSelections(USER))"}>}Count)

marcus_sommer

Just remove Year=, Month=, Day=,CATEGORY= , from your expression to make it responsible again to those selections.

Kaushik2020
Creator III
Creator III
Author

thanks for the reply. below is how my set expression looks like. Seems data is just 0 :S

 

Sum(
Date={">=$(=date(monthstart(max(Date))))<=$(=date(max(Date)))"}
Count)

 

Kaushik2020
Creator III
Creator III
Author

This works well when we select only 1 value. if nothing is selected the value becomes 0 in the UI. 

is there any way we can show default values when no filter applied based on the criteria in the set expression I have ? 

marcus_sommer

Maybe there are future dates within the data-set. In this case you need to exclude them - maybe with another set analysis within the max(Date), like:

{">=$(=date(monthstart(max({< KPI = {"*"}>} Date))))<=$(=date(max({< KPI = {"*"}>} Date)))"}

whereby KPI is just a placeholder for an appropriate related field within your facts - something like Sales or Amount.