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: 
Sunil_Kenth
Former Employee
Former Employee

Help with Set Analysis syntax

Hi all,

I am trying set the expression for  a Gauge chart to only calculate for the parent category of 'Telecoms' and for the current year and month.

I have setup variables for the month and year as follows:

vCurrentMonth = (Month(Max(Date))

vCurrentYear = (Year(Max(Date))

='£'& Num (Sum({$< [Parent Category] = {'Telecoms'}, Month = {$(=$(vCurrentMonth))}, Year = {$(=$(vCurrentYear))}>}[Money Out]))

The result i get for this expression is £0

Any ideas?

Thanks

1 Solution

Accepted Solutions
Sunil_Kenth
Former Employee
Former Employee
Author

Thanks Enrich - your answer prompted me to wrap a num function around the current month variable so I now have vCurrentMonth=num(Month(Max(Date)) and this now works.

Thanks for the quick response.

Sunil

View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

I guess you have a problem with the date format in set analysis.

In this case, you should create a field on script where month is a number, instead of a formated date.

The syntax on the script would be:

Load (...)

num(Month) as nMonth

from / Resident... etc

Then, the variable would be:

vCurrentMonth = num((Month(Max(Date)) )

Then, the expression would be:

='£'& Num (Sum({$< [Parent Category] = {'Telecoms'}, nMonth = {$(=$(vCurrentMonth))}, Year = {$(=$(vCurrentYear))}>}[Money Out]))

Maybe the expression can be simpler, like this:

nMonth = {$(vCurrentMonth)}

or

nMonth = {$(=vCurrentMonth)}

Hope this helps,

Erich

Sunil_Kenth
Former Employee
Former Employee
Author

Thanks Enrich - your answer prompted me to wrap a num function around the current month variable so I now have vCurrentMonth=num(Month(Max(Date)) and this now works.

Thanks for the quick response.

Sunil