Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
nazirhussain
Contributor
Contributor

Variable not working in Set Analysis

Hi,

I am using variable in my expression which has a set analysis in it. However it is not working.

The below expression works when I hardcode date in it.

count(distinct {<[MasterCalendarDateStartedRC.LocalFiscal_YearQlik]={'2018'}>} [ReportCard.studentid])

However, this does not.

count(distinct {<[MasterCalendarDateStartedRC.LocalFiscal_YearQlik]={'$(PreviousLocalYear)'}>} [ReportCard.studentid]).

My variable has proper value in it. I am able to see the proper year in my variable. However, the above expression always returns 0. Not sure, what am doing wrong.

Please help. Thanks.

3 Replies
Vegar
MVP
MVP

You did not tell  us the content of your variable. Is it an expression? 

Try adjusting your expression to this:

count(distinct {<[MasterCalendarDateStartedRC.LocalFiscal_YearQlik]={'$(=PreviousLocalYear)'}>} [ReportCard.studentid])

nazirhussain
Contributor
Contributor
Author

Thanks for responding.. I tried modifying my expression but it still returns 0.

My 'PreviousLocalYear' variable will contain year values like 2019, 2018 etc., TheLocalFiscal_YearQlik column in MasterCalendarDateStartedRC also contain year values like 2019, 2018. I am trying to retrieve values from MasterCalendarDateStartedRC table based on the year value in my variable.

Brett_Bleess
Former Employee
Former Employee

Best I can offer is the following Design Blog post on Set Analysis, and I will include the base Design Blog URL after that in case you want to search for other posts that may be helpful.

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

The other post that may be helpful would be the following:

https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.