Forum Discussion
HELP URL IMAGE TOP N - No have idea
- 9 years ago
Hi snaydeck
To solve the tie break, I can think of following strategy
With the tie break, lets assume that Lowest Product ID will be Ranked Higher i.e. following desired result
employee product_id sum_qty image_product rank A 1111 100 img/qwe.jpg 1 A 2222 100 img/asd.jpg 2 A 3333 60 img/zxc.jpg 3
Add a Calculated Column (which only affects the Qty in decimals)Dummy Qty = Table1[sum_qty] - Table1[product_id] / 10000
Then use above Column to RANK.Revised Rank = RANKX ( FILTER ( Table1, Table1[employee] = EARLIER ( Table1[employee] ) && Table1[Dummy Qty] >= EARLIER ( Table1[Dummy Qty] ) ), Table1[Dummy Qty], , , DENSE )
Hi snaydeck
Add a caculated Columm to your table
Rank =
CALCULATE (
COUNT ( Table1[sum_qty] ),
FILTER (
Table1,
Table1[employee] = EARLIER ( Table1[employee] )
&& Table1[sum_qty] >= EARLIER ( Table1[sum_qty] )
)
)This will range images for each employee.
Now insert a slicer for RANK and Employees.
To select Top 2 you would then have to select 1 and 2 both from the RANK slicer
Hope this helps
Hi my friend Zubair_Muhammad. Thanks Again for try to help me like the usual.
So I create the column with Rank, it worked fine, but I have a problem.
When the numbers are the same.
Example, let's assume that in row one 40 is 100 now.
| employee | product_id | sum_qty | image_product |
| A | 1111 | 100 | img/qwe.jpg |
| A | 2222 | 100 | img/asd.jpg |
| A | 3333 | 60 | img/zxc.jpg |
| employee | product_id | sum_qty | image_product | rank |
| A | 1111 | 100 | img/qwe.jpg | 2 |
| A | 2222 | 100 | img/asd.jpg | 2 |
| A | 3333 | 60 | img/zxc.jpg | 3 |
I'm without TOP 1 (rank with the number 1)
Is there a way to solve this?
It is very important that it comes without duplicate rank.
I have two other columns that can serve as a tiebreaker, if necessary. Column X (number) and column Y (date).
If you can help me, thank you so much!
Thanks man!!!
- Zubair_Muhammad9 years ago
Community Champion
Hi snaydeck
In that case, if you use the formula below then RANK 1 would not be skipped.
But then there would be 2 items with Rank 1Rank = RANKX ( FILTER ( Table1, Table1[employee] = EARLIER ( Table1[employee] ) && Table1[sum_qty] >= EARLIER ( Table1[sum_qty] ) ), Table1[sum_qty], , , DENSE )You will get
employee product_id sum_qty image_product rank A 1111 100 img/qwe.jpg 1 A 2222 100 img/asd.jpg 1 A 3333 60 img/zxc.jpg 2 - Zubair_Muhammad9 years ago
Community Champion
Hi snaydeck
To solve the tie break, I can think of following strategy
With the tie break, lets assume that Lowest Product ID will be Ranked Higher i.e. following desired result
employee product_id sum_qty image_product rank A 1111 100 img/qwe.jpg 1 A 2222 100 img/asd.jpg 2 A 3333 60 img/zxc.jpg 3
Add a Calculated Column (which only affects the Qty in decimals)Dummy Qty = Table1[sum_qty] - Table1[product_id] / 10000
Then use above Column to RANK.Revised Rank = RANKX ( FILTER ( Table1, Table1[employee] = EARLIER ( Table1[employee] ) && Table1[Dummy Qty] >= EARLIER ( Table1[Dummy Qty] ) ), Table1[Dummy Qty], , , DENSE )