Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Ayoub
Contributor III
Contributor III

Percentage Calculation

Hello Community , 

i'm facing a little problem with my new application , on the chart i wanna calculate the percentege of my Dimension by year like this : ( As you can see the %Sales on red is calculated by deviding 585 788 by 771 397 )

The EXPRESSION I WROTE IS :  Count(DISTINCT Sales )/Count(TOTAL DISTINCT <Ex> sales) but it doesn't give me the result i want

Ex.Pack GarTotal sales % sales 
2020P1585 78876%
2020P2142 81519%
2020P357 8908%
2020P41640%
2020Total771 397100%
2019P1598 95378%
2019P2149 49819%
2019P341 1635%
2019P4240%
2019Total772 540100%

 

i tried so many expression by the way, but none of them worked for me .

I really hope u helping me .

Thank you once again 

1 Solution

Accepted Solutions
Ayoub
Contributor III
Contributor III
Author

yes i agree with both of youu ! but the situation obliged me to use count instead of sum.. 
cuz i wouldn't  put some secret info so i used and example by sales . 

So THE SOLUTION was pretty similar : 

 

Count(DISTINCT IMMATRICULATION)
/
Count( DISTINCT TOTAL <Ex_gar_auto> IMMATRICULATION)

Thank you @PrashantSangle & @MindaugasBacius for ur kind time.. and sorry for my late response . 

 

View solution in original post

4 Replies
akshatagrawal
Partner - Contributor III
Partner - Contributor III

Can you please help in understanding whether total for each year will be same as P1+P2+P3+P4 or not.

In data I can see it differs.

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Do field Sales represent Sales ID or number?

I guess try using Sum instead of Count.

PrashantSangle

Yes @MindaugasBacius is correct. try below code

Sum(Sales) / Sum(Total <Ex> Sales)

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Ayoub
Contributor III
Contributor III
Author

yes i agree with both of youu ! but the situation obliged me to use count instead of sum.. 
cuz i wouldn't  put some secret info so i used and example by sales . 

So THE SOLUTION was pretty similar : 

 

Count(DISTINCT IMMATRICULATION)
/
Count( DISTINCT TOTAL <Ex_gar_auto> IMMATRICULATION)

Thank you @PrashantSangle & @MindaugasBacius for ur kind time.. and sorry for my late response .