Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik Sense , can not put a function into set analysis

Hello :

in my case , I want to set a variable, and then put the variable into a KPI/BAR CHART .but I find it is not working for me.

my Step 1:

Set getLastMonth = monthname(Max([Refresh Date]));

Set KPI =    Sum({$<[Refresh Date]={"$(=$(getLastMonth))"}>} [Total]) ;

my Step 2:

in a KPI, I put

$(KPI)

but it is not working for me , it just return '0'.


my Step 3:

I put  Sum({$<[Refresh Date]={"$(=$(getLastMonth))"}>} [Total]) directly into the KPI, then it is working and return correct value.

thanks

Xu Zhao

4 Replies
Anonymous
Not applicable
Author

BTW,

I also tried put variable  KPI in the chart, and

it only returns Sum({$<[Refresh Date]={""}>} [Total]) , which means it did not get $(=$(getLastMonth))

ogautier62
Specialist II
Specialist II

Hi,

and with this :

Set KPI =Sum({$<[Refresh Date]={"=$(getLastMonth)"}>} [Total]) ;

it should work

regards

Chanty4u
MVP
MVP

can you share your app?

how expression you set in variable?   with "="  or without  =   ?

Anonymous
Not applicable
Author

Hi Olivier,

I also tried your statement, but it will  not only return the last month, it returns all months.

so that I have to do Sum({$<[Refresh Date]={"$(=$(getLastMonth))"}>} [Total]) .

From software development point of view, I do not like to use the statement directly in the wiget.