Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
byrnel0586
Creator
Creator

Using Variable as Field Name in Set Analysis

Hi all,

I have a simple set analysis expression that I want to use a variable I created instead of a field name. I can't seem to get it to work. I have looked around the community, but no solutions are working for me.

Variable:

vYearAvgEnrollment = sum(Avg_Enrollment) *do not have the equal sign in variable definition*

Expression:

=COUNT({<$(vYearAvgEnrollment)={">=100"}>}DISTINCT G_CONTRACT_ID) 

Any help is appreciated.

 

1 Solution

Accepted Solutions
Vegar
MVP
MVP

You can only use a variable as a field name if the variable is an field name.

Eg vFieldName = G_CONTRACT_ID

 

However you should probably be able tp accomplish what you want whith the following expression.

Count({<G_CONTRACT_ID={"=$(vYearAvgEnrollment)>=2000"}>}Distinct G_CONTRACT_ID) 

 

View solution in original post

3 Replies
Lisa_P
Employee
Employee

You can't use a variable as a field in set analysis

Vegar
MVP
MVP

You can only use a variable as a field name if the variable is an field name.

Eg vFieldName = G_CONTRACT_ID

 

However you should probably be able tp accomplish what you want whith the following expression.

Count({<G_CONTRACT_ID={"=$(vYearAvgEnrollment)>=2000"}>}Distinct G_CONTRACT_ID) 

 

byrnel0586
Creator
Creator
Author

That explains why it was not working then 🙂

Thank you, your expression is working for my needs.