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: 
Not applicable

How to use a variable to create a dynamic expression

I am new to QlikView so any help on this is greatly appreciated.

With the current version of our corporate dashboard, we have a simple bar chart with below expression define on the expression tab of the chart.

COUNT(ENROLLED_STUDENT_KEY) / COUNT(DISTINCT IF(ENROLLED_FLAG = 1, PERSON_ID))

The new requirement from our business users calls for dynamic calculation of the denominator as shown below.

COUNT(ENROLLED_STUDENT_KEY) / COUNT(DISTINCT IF( Dynamic Expression Here , PERSON_ID))

I attempted to use a variable as shown below. My idea was to have the value of the variable set to whatever the filter selected by the user. I tested this idea by defining the value the variable to 'ENROLLED_FLAG = 1' (without the quotes) but the chart would simply not render.

COUNT(ENROLLED_STUDENT_KEY)/COUNT(DISTINCT IF(=$(StudentPopulationFlag), PERSON_ID))



1 Solution

Accepted Solutions
Not applicable
Author

I don't think you want the equal sign before the dollar sign expansion. Have you tried it without?

Other than that, the expression looks sound.

View solution in original post

2 Replies
Not applicable
Author

I don't think you want the equal sign before the dollar sign expansion. Have you tried it without?

Other than that, the expression looks sound.

Not applicable
Author

Thank you!!! That what my problem was :).