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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis with variable

I want to use varaible in analysis

for example

SYear and SMonth are variables.

The below expression work well

count(total<UsageYearMonth>{<UsageCategory = {'ActiveStudent'},

UsageYear = {'$(=SYear)'},UsageMonth ={'$(=SMonth)'}>} distinct OrderId)

But if I want to  use function on the varaible ,how should I write the set analysis?

I mean if now I have a varaible named ReportDate,date type

I want to use Year function to get the year part. like Year($(=ReportDate))

then the analysis should be

count(total<UsageYearMonth>{<UsageCategory = {'ActiveStudent'},

UsageYear = {'Year($(=ReportDate))'},UsageMonth ={'Month($(=ReportDate))'}>} distinct OrderId)

I dont know how could i get it work?

10 Replies
Not applicable
Author

Than you for so detailed description,but it seems not right.

And I've figured out the right way.

It should be below:

count(total<UsageYearMonth>{<UsageCategory = {'ActiveStudent'},

UsageYear = {$(=Year('$(ThisMonthEndDateVar)'))},

UsageMonth = {$(=Month('$(ThisMonthEndDateVar)'))}>} distinct OrderId)