Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Gaëtan
Contributor II
Contributor II

top 10% PERCENT by date

Hello,

I want to select the TOP 10% of my entreprises which generate the most revenue.

 Today i use this expression :

=if(aggr(Rank(Sum(CA)),DATE_DAY,ENTREPRISE_ID)<=round(count(TOTAL ENTREPRISE_ID)*0.10),Sum(CA))

 

entreprise_id.png

it work fine if i'm at entreprise_id level but I want a vision by day for do a graph and have a evolution by day

date_day.png

Do you have a solution ?

Thanks in advance

1 Solution

Accepted Solutions
sunny_talwar

You only have a single dimension (DATE_DAY) in your CA Graph and the expression outputs 2 value... what do you want to do with them? Sum them? Avg Them?.. for Sum you can try this

=Sum(Aggr(If(Rank(Sum(CA)) <= Round(Count(DISTINCT TOTAL <DATE_DAY> ENTREPRISE_ID) * 0.10), Sum(CA)), DATE_DAY, ENTREPRISE_ID))

 For Avg

=Avg(Aggr(If(Rank(Sum(CA)) <= Round(Count(DISTINCT TOTAL <DATE_DAY> ENTREPRISE_ID) * 0.10), Sum(CA)), DATE_DAY, ENTREPRISE_ID))

Capture.PNG

View solution in original post

8 Replies
jyothish8807
Master II
Master II

May be try like this:

=if(aggr(Rank(Sum(CA)),DATE_DAY)<=round(count(TOTAL ENTREPRISE_ID)*0.10),Sum(CA))

 

 

Best Regards,
KC
Gaëtan
Contributor II
Contributor II
Author

Thanks for the reply,

I already test this expression and It's not work . it give me the total of the revenue (1476)

jyothish8807
Master II
Master II

Could you please share your expected output, i am not still clear with your requirement.

If you want the list at Date level, then the output will be one value for one date.

 

 

Best Regards,
KC
Gaëtan
Contributor II
Contributor II
Author

hello,

for exemple

20 entreprise ID : 10% = 2 entreprise_iD

I must select the entreprise 7 and 18 because they have the most revenue in the list : total revenue 180

3.png

I want only the result of this calcul for each day

 

4.png

I want tell for every day : 10% of my top entreprise generat X % of my revenue

 

thanks

sunny_talwar

May be something like this

=Aggr(If(Rank(Sum(CA)) <= Round(Count(DISTINCT TOTAL <DATE_DAY> ENTREPRISE_ID) * 0.10), Sum(CA)), DATE_DAY, ENTREPRISE_ID)
Gaëtan
Contributor II
Contributor II
Author

same problem, here my application

sunny_talwar

You only have a single dimension (DATE_DAY) in your CA Graph and the expression outputs 2 value... what do you want to do with them? Sum them? Avg Them?.. for Sum you can try this

=Sum(Aggr(If(Rank(Sum(CA)) <= Round(Count(DISTINCT TOTAL <DATE_DAY> ENTREPRISE_ID) * 0.10), Sum(CA)), DATE_DAY, ENTREPRISE_ID))

 For Avg

=Avg(Aggr(If(Rank(Sum(CA)) <= Round(Count(DISTINCT TOTAL <DATE_DAY> ENTREPRISE_ID) * 0.10), Sum(CA)), DATE_DAY, ENTREPRISE_ID))

Capture.PNG

Gaëtan
Contributor II
Contributor II
Author

Thank you !!! it works perfect

indeed, I forget to add a sum / avg