Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot Table and Totals

How can one use the totals from the pivot table on one of the raws to get a ratio of a different raw on the same table?. I can not use the static total that is there because it will change maybe even on a daily bases so I may need some code or something else.

5 Replies
whiteline
Master II
Master II

Hi.

Just use 'total' statement in the same expression.

For example:

=Sum(sales)/Sum(total sales)

The second sum discards all dimensions and return grand total. If you need a partial total you can use total<Dim1, Dim2> to keep some dimensions.

Not applicable
Author

I have tried that one but doesnt return the correct ratios. The ratio is suppose to be the (expression/total) * 100

Is there no other way of doing this? Thanks for your response though....

whiteline
Master II
Master II

What is the problem with ratios, that they doesn't multiplied by 100 or something else ?

Coule you provide your expression ?

Not applicable
Author

This is the expression for the above value

SUM(IF(vStatus = 'CXD',[CANCELLED],
    
REINSTATED))

And the expression for the Ratio calculation looks like this

SUM(IF(vStatus = 'CXD',[CANCELLED],REINSTATED))

/

SUM(TOTAL(IF(vStatus = 'CXD',[CANCELLED],
    
REINSTATED)))

The answers from the ratio expression are not the correct answers. Myltiplying by a 100 is not necessary as I have already ticked the percentage option on qlikview.

whiteline
Master II
Master II

I think you can't do it that way.

Try:

=Rangesum(Sum({<vStatus = {'CXD'}>} [CANCELLED]),Sum({<vStatus -= {'CXD'}>} [REINSTATED]))

/ Rangesum(Sum({<vStatus = {'CXD'}>} total [CANCELLED]),Sum({<vStatus -= {'CXD'}>} total [REINSTATED]))