Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator II
Creator II

Pick and Match in Script and using in expression

Hi Community,

I have island table for button selection, based on button selection expression will be calculated like (MTD, YTD etc...)

I have created variable like below and applied expression as mention below - This is working fine for me...

 

Expression: count(DISTINCT {<$(vCurrntYear )>} ID )

Same way I have applied in the Script

 

Expression: count(DISTINCT {<ABC>} ID )  - This is not working (is there any way to achieve)

Thanks in Advance!

Labels (4)
4 Replies
Digvijay_Singh

Any reason you are doing it in script?, set expressions only work in front end charts. Are you trying to create variable having measure expressions in the script and then want to use them in the chart?

Can you share the exact script statements where things are not working?

paulwalker
Creator II
Creator II
Author

Visually I'm facing optimization issue, so I have written in scripting level.

 

marcus_sommer

Calling ABC in this way is just a field and it won't be regarded as a valid set analysis. To get it to work you may try something like this:

count(DISTINCT {< $(=maxstring(ABC)) >} ID)

But IMO you won't increase the performance or simplifying your approach by moving the set analysis string from the UI to the script. If your calculation is too slow you will need optimizations to your data-model maybe by developing it in the direction of a star-scheme.

- Marcus

Or
MVP
MVP

Adding to @marcus_sommer 's answer, which I agree with, you should consider scrapping your island table and using a variable instead. That might actually help performance. See: https://qlikviewcookbook.com/2015/06/the-impact-of-data-islands-on-cache-and-cpu/