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: 
Nicolai_Mads
Partner - Contributor II
Partner - Contributor II

Sum of master measure in KPI visualizations

Hi, I am fairly new in Qlik sense and are experiencing some challenges related to visualizing the sum of the master measure outlined below:

if(interval(today(2)-daystart(max({<[Session Count] = {1}>} LogTimeStamp)),'d') >= 200,

if ([App Published] = 'True',

if(WildMatch([App Stream], 'x*', 'y*', 'z*') = 0,

count (distinct AppId),0),0),0,)

This master measure identifies the apps that needs to be deleted (according to the 3 if statements). 

But rather than having the user to click the table in order to identify the number of apps that needs to be deleted, I would much rather use a KPI visualization. So my initial thought was to replace the count function with a sum function which did not work. After that I tried wrapping the the sum function around the 3 three if statements which returned an error message saying that nested aggregation is not allowed. 

Any thoughts on how to proceed? 

Thx in advance

3 Replies
stevejoyce
Specialist II
Specialist II

Try this below.  It can be done with if statement + aggr, but it should be done with set analysis.

Count({<AppId = {"=interval(today(2)-daystart(max({<[Session Count] = {1}>} LogTimeStamp)),'d') >= 200"},  [App Stream] = {"=WildMatch([App Stream], 'x*', 'y*', 'z*') }, [App Published] ={'True'}>} Distinct AppId)

Nicolai_Mads
Partner - Contributor II
Partner - Contributor II
Author

Thanks for pointing me in the right direction Stevejoyce!  

I modified the expression to a set analyses rather than using if statements. 

Here is how it looks like: 

count({<AppId ={'=sum(aggr(interval(today(2)-daystart(max({<[Session Count] = {1}>} LogTimeStamp))), AppId))>= 200'},
[App Stream] -= {'x*', 'y*', 'z*'},
[App Published] ={'True'}
>}distinct AppId)

Joseph_Musekura
Support
Support

What happens if you remove the last ',' before the last parenthesis and after 0?
It seems like the first IF statement is expecting value to be added after the  last ','

ex
if(condition true, 0) or

if(condition true, 0, 1). Then you could add any nested statement in between

/joseph