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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Inserting a variable into set analysis expression

I am trying to have a set analysis expression that is dynamic for the country name.

Hence I want to manipulate the following expression

=num(count(distinct {<CountryName ={'United Kingdom'}>}SeriesRaceEventKey),'#,##0')

I have made a variable called vCountry but inserting this into the expression does not work.

The script editor says "Expression OK" but the result is blank.

=num(count(distinct {<CountryName =vCountry_Name_A>}SeriesRaceEventKey),'#,##0')

Am I using the wrong syntax? (If I am the script editor would indicate this as a Bad Expression ??)

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Perhaps this

=count({<CountryName ={'$(vCountry_Name_A)'}>} distinct SeriesRaceEventKey)

Regards

Jonathan

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

View solution in original post

8 Replies
Not applicable
Author

Hi,

Try:

=num(count(distinct {<CountryName =$(vCountry_Name_A)>}SeriesRaceEventKey),'#,##0')

Not applicable
Author

Add $ sign and the variable in brackets like below

=num(count(distinct {<CountryName =$(vCountry_Name_A)>}SeriesRaceEventKey),'#,##0')

Regards,

Sajeevan

Anonymous
Not applicable
Author

Tired that but no luck. Perhaps it is the way I defined the variable?

I created it with:

vCountry_Name_A    = 'United Kingdom'

Not applicable
Author

Forgot to add the curly brackets - try this

=num(count(distinct {<CountryName ={$(vCountry_Name_A)}>}SeriesRaceEventKey),'#,##0')

Anonymous
Not applicable
Author

I have tried that as well, still no luck.

Perhaps I should just not use a variable

Not applicable
Author

Can you attach a sample QV file? There is no harm in using a variable.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Perhaps this

=count({<CountryName ={'$(vCountry_Name_A)'}>} distinct SeriesRaceEventKey)

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thanks Jonathan,

This works, strange solution that I would not have guessed.

I presume this is a sort of bug in QV....