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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis inheritance

Hey all,

I'm writing a couple of variable to calculate KPI's and min/avg/max values of thoose KPI's. The min/avg/max should be calculated ignoring certain selections in the qvw. The problem is that the written functions can get very long. For example:

KPI = count(value)*(max(date)-min(date))

When I need to remove the filters to calculate min/avg/max then I need to use something like:

KPI_avg = avg({$<removeValue=>}count({$<removeValue=>}value)*(max({$<removeValue=>}date)-min({$<removeValue=>}date)))

I have a longer function for my KPI and an even longer selection I need to ignore.

So my question is: can I let the set analysis be inherited by defining my 'ignore selection' only once? for ex:

KPI_avg_wanted = avg({$<removeValue=>}count(value)*(max(date)-min(date)))

I tried something similar to the above but that doesn't work. Anyone got suggestions? thanks!

3 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

You need to give set analysis expression for every individual method you use in the expression.  So, I don't think it is possible, you have to specify like this

KPI_avg = avg({$<removeValue=>}count({$<removeValue=>}value)*(max({$<removeValue=>}date)-min({$<removeValue=>}date)))

Regards,

Jagan.

Not applicable
Author

Thanks, that's what I thought but I had hoped to be wrong

swuehl
MVP
MVP

I believe something like

= avg({$<removeValue=>}count({$<removeValue=>}value)* max({$<removeValue=>}date)-min({$<removeValue=>}date)))

shouldn't work at all, since you are embedding aggregation functions into another aggregation function. You need to use advanced aggregation to handle this.