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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mehek9074
Partner - Contributor II
Partner - Contributor II

Variable in set analysis modifier not working

Hello All
Need Urgent help regarding this

I am having a variable eg. vVar1= vVarA/vVarB
And I am using this variable in a set analysis modifier like this:
Count(distinct {<Field_A= {"=$(vVar1) =1"}>} Field_A)
But however it's not working.
Appreciate if anybody can help on this.

7 Replies
tresesco
MVP
MVP

What are you trying to compare the field Field_A with? Could you explain the logic/filter for Field_A? It's bit confusing when you compare a variable with 1. 

mehek9074
Partner - Contributor II
Partner - Contributor II
Author

Actually I have stored one kpi formula in a variable(vVar1).

Whenever this variable formula is evaluated, it gives some values between  1to 20.

so I want to get the count of only those values of fieldA where that vVar1 value is 1.
i.e  count of fieldA wherever vVar1= 1

tresesco
MVP
MVP

This condition looks a vague one to me. Could you explain with an example? Could you share the two variables definitions ?

mehek9074
Partner - Contributor II
Partner - Contributor II
Author

Hi 

I have uploaded the dummy data file and sample qvf.

I have created a variable vKPIOverallScore in the script and
I am trying to use the variable in set analysis modifier in a KPI measure on UI.

But its not working.
Moreover, I tried creating a flag with if condition in the script by using that variable but no luck.

 

tresesco
MVP
MVP

You have to make a change in quotes in variable definition to avoid conflict. Try like:

Let vKPIOverallScore='round((Avg({$'&'<Year = {[$'&'(=max(Year))]}>}Scores)) ,0.01)';

 

I used '['']' (in red) in place of single quotes

mehek9074
Partner - Contributor II
Partner - Contributor II
Author

Is it working for you ?
because I tried , it is not working for me.

tresesco
MVP
MVP

I am getting 9 as output.

Capture.PNG