Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

Handling pourcentages in a pivot table

Hi all, stalwar1‌ , vinieme12

I have the following table :

Capture.PNG

I'm using this expression:

if(Dimensionality()=1, sum(Taux)/sum(total Taux),

if(Dimensionality()=2,

sum(Taux) /sum(total Taux) ))

What I want is, when dimensionality()=2, to have sum(Taux) / sum(Taux) of the first dimension; the pourcentage of each plaque % its Type Materiel and not % Total

How to achieve this? Thanks

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

I think this

if(Dimensionality()=1, sum(Taux)/sum(total Taux),

if(Dimensionality()=2,

sum(Taux) /sum(total <[Type Materiel]> Taux) ))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

14 Replies
antoniotiman
Master III
Master III

Try

Sum(TOTAL <[Type Materiel]> Taux)/Sum(TOTAL Taux)

Regards,

Antonio

vinieme12
Champion III
Champion III

I think this

if(Dimensionality()=1, sum(Taux)/sum(total Taux),

if(Dimensionality()=2,

sum(Taux) /sum(total <[Type Materiel]> Taux) ))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
OmarBenSalem
Author

Yes, based on Antonio's response, this is how I altered my expression as so, But that does not seem to work.

In fact, if I sum( the 0.64%) it would be much greater than 16.29%..

Capture.PNG

sunny_talwar

I think Vineeth's expression is slightly different... try using his expression and I am sure it will work for you

OmarBenSalem
Author

This is the expression I'm using:

if(Dimensionality()=1, sum(Taux)/sum(total Taux),

if(Dimensionality()=2,

sum(Taux) /sum(total <[Type Materiel]> Taux) ))

sunny_talwar

If you want sum of rows to add up to the total... you will need the same denominator for both of them.... In that case your original expression (without needing dimensionality()) would give you that

sum(Taux)/sum(total Taux)

Now when you sum each 0.10... and all... they would sum upto 16.29%.... using different denominator will never give you the sum

OmarBenSalem
Author

What an idiot I am

This is normal; if I sum them up, the sum would be 100% since they represent 100% of their Material Type..

Haa, and that was so obvious..

Well, thanks guys !

OmarBenSalem
Author

between,

Sum(TOTAL <[Type Materiel]> Taux)

is like saying


aggr(Sum(TOTAL Taux),[Type Materiel]) ?


Maybe, the syntax of the second expression won't work, but this is what It's doing?

sunny_talwar

More like this

Aggr(NODISTINCT Sum(Taux), [Type Materiel])