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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use subtotal in an expression

Hi Folks

I have a pivot table which has 4 hierarchial levels and a single value.

I would like at level 1 to change the colour of the text if the sum of all values for that level is N, and of course I'd like to do the same for level 2 & 3, whereas level 4 is the lowest level and so simply doing IF(SUM(X)<>0,RED()) works perfectly.

Anybody know how I can use the value of the partial sum in an expression?

Cheers,

Nigel.

2 Replies
Anonymous
Not applicable
Author

Hi Nigel,

I think you should be able to use aggr() here, for example on level 3:

IF(aggr(sum(X), Dim1, Dim2, Dim3)<>0,RED())

If you aggregate the sum over the current dimension level you're on it should color the pivot dimension accordingly

Not applicable
Author

Hi Jsn

Thanks for the very prompt response, much appreciated.

I tried that and it works fine for levels 2 and 3, but doesn't work on level 1. If I put the statement in as anexpression (i.e. aggr(sum(x),Dim1) then what I get is a blank value at the first line and a value of 4 on the second line. It would appear that the expression to change colour is probably referencing the first line.

My question is though, why would the result of this expression by any different for any row within the same group? That seems a little bit weird to me?

Cheers,

Nigel.