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: 
Nora104
Partner - Creator
Partner - Creator

QtySold country top 5 of region weekly trend

below is the data:

1.png

We can see in week 1 ,top 5 Store of all region = region1 (3) + region2 (2);in week 2 ,top 5 Store of all region = region1 (1) + region2 (4).

I can use to calculate the result of one week:

count({<Week={"1"}>}distinct aggr(
if(num(rank(sum({<Week={"1"}>}QtySold),1,1))<=5,
Store_Name),Store_Name));

count({<Week={"2"}>}distinct aggr(
if(num(rank(sum({<Week={"2"}>}QtySold),1,1))<=5,
Store_Name),Store_Name));

2.png

 

But I need both two week result together in one chart,like below:

Nora104_1-1685587054505.png

could anyone can solve it?Thanks!

 

Labels (1)
2 Solutions

Accepted Solutions
Kushal_Chawda

@Nora104  try below

count(distinct aggr(if(num(rank(sum(QtySold),1,1))<=5,Store_Name),Week, Store_Name))

View solution in original post

BrunPierre
Partner - Master
Partner - Master

Another way could be like this

=Count(DISTINCT Aggr(If(Rank(Sum(QtySold)) < 6, Store_Name), Week, Store_Name))

View solution in original post

6 Replies
BrunPierre
Partner - Master
Partner - Master

Have you given it a try yet, by summing both expressions?

Nora104
Partner - Creator
Partner - Creator
Author

I need to show 52 weeks, it is too long to write 52 formula......

Kushal_Chawda

@Nora104  try below

count(distinct aggr(if(num(rank(sum(QtySold),1,1))<=5,Store_Name),Week, Store_Name))
BrunPierre
Partner - Master
Partner - Master

Another way could be like this

=Count(DISTINCT Aggr(If(Rank(Sum(QtySold)) < 6, Store_Name), Week, Store_Name))

Nora104
Partner - Creator
Partner - Creator
Author

It works well! Thank you so much!

Nora104
Partner - Creator
Partner - Creator
Author

It works well! Many Thanks!!