Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
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
Partner

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
Partner

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.
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