Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
Perus_Pena
New 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

1 Solution

Accepted Solutions
Partner
Partner

Re: Using GetSelectedFields in set analysis via variable

let's try with the below syntax:

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

I hope this could help.

2 Replies
Partner
Partner

Re: Using GetSelectedFields in set analysis via variable

let's try with the below syntax:

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

I hope this could help.

Perus_Pena
New Contributor III

Re: Using GetSelectedFields in set analysis via variable

Thanks, this worked perfectly!