Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Perus_Pena
Contributor III
Contributor III

Using GetSelectedFields in set analysis via variable

Hello everyone,

I have simple table listing months which is used to select YearMonth values from multiple tables. I have then multiple measures that I'd like to declare as variables in the Script editor. I will be calculating e.g. v.Count_A / v.Count_B type of measures.

This works as a measure: COUNT(distinct {<YearMonth={'$(=getfieldselections(SelectedPerioid))'}>} %_ID)

But if I use this in QlikScript like this:

Let v.Count = 'COUNT(distinct {<YearMonth={"$(=getfieldselections(SelectedPerioid))"}>} %_ID)';

--> Will show COUNT(distinct {<YearMonth={""}>} %_ID) on the app side.

I guess the $ will make the script will return "" for the field selection as there is no variable with that name. So how can I force that $(=get...Perioid) to be used on the app side?

Regards,

Pena

Labels (2)
1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

let's try with the below syntax:

LET v.Count = 'COUNT(distinct {<YearMonth={' & '$' & '(=getfieldselections(SelectedPerioid))}>} %_ID)';

I hope this could help.

View solution in original post

2 Replies
agigliotti
Partner - Champion
Partner - Champion

let's try with the below syntax:

LET v.Count = 'COUNT(distinct {<YearMonth={' & '$' & '(=getfieldselections(SelectedPerioid))}>} %_ID)';

I hope this could help.

Perus_Pena
Contributor III
Contributor III
Author

Thanks, this worked perfectly!