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 % Totals

Hi all,

I have a pivot table as shown below. there is an expression which calculates the % which is working per line but the subtotals and totals are not working. (As you can see it shows 33.33% for each.

Does anyone know how i can fix this please?

The expressions used are ..

Score

Sum(Score)

Percentage

=sum(Score)/sum({<City=>}(aggr(NODISTINCT sum( Score), Country)))

Capture.JPG

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try:

if(Dimensionality()=3, sum(Score)/sum(total <Country,Continent> Score),

if(Dimensionality()=2, sum(Score)/sum(total <Continent> Score),

sum(Score)/sum(total Score)))


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Not applicable
Author

Hi

Try this:

=sum(Score)/sum(TOTAL<City> aggr(sum(Score),Continent,Country, City))

TMF

Message was edited by: tmendesf

Not applicable
Author

Hi TMF,

That works for the totals but now each line reports as 100% as below

Capture.JPG

Not applicable
Author

Hi

Try this:

=sum(Score)/sum(TOTAL<City> aggr(sum(Score),Continent,Country))

TMF

Not applicable
Author

Hi, thanks again but now im getting some lines reporting nothing..

Nottingham for example should be reporting 20/35*100 =  57.14% but is showing -

Capture.JPG

Not applicable
Author

Can you post a sample file?

Not applicable
Author

Hi, yes here is a sample

Gysbert_Wassenaar

Try:

if(Dimensionality()=3, sum(Score)/sum(total <Country,Continent> Score),

if(Dimensionality()=2, sum(Score)/sum(total <Continent> Score),

sum(Score)/sum(total Score)))


talk is cheap, supply exceeds demand