Pivot table - Use count function based on Ranking

Copper Contributor

Hi,

 

Is there a way in pivot table based on the ranking values to count the number of times an item has appeared in the top 5 for last 4 weeks?

 

I am trying to achieve the far right column below in excel pivot table. Is this possible?

 

 Week 1Rank for Week 1Week2Rank in Week 2Week3Rank in Week 3Week4Rank in Week 4Times appeared in top 5 in 4 weeks
Item 188196327656949131
Item 255683264464775561
Item 3357583910394683680
Item 440362713214387992
Item 589110919771068942
Item 61563102373582672
Item 712223365335420013
Item 820947649110221423
Item 94607655876173051
Item 10117144265788936101

 

Thanks in advance

4 Replies

@lucioxiii 

Perhaps I misunderstood. We speak about structured table or about PivotTable ? If PivotTable what is the source for it?

For the structured table it could be like

=LET(
  large5, LARGE([Rank for Week 1], SEQUENCE(5)),
  ranks,  INDEX( Table1, ROW() - ROW(Table1[#Headers]), {3,5,7,9}),
  SUM( IF( ISNA( XMATCH(ranks, large5) ), 0, 1)) )

but that doesn't meet your manually added column. Perhaps you may give bit more details.

@Sergei Baklan 

 

I am working in a pivot table. So using the Pivot table ranking feature (as explained in this link for 2010 versions and above). The pivot table sources is a table within the workbook.

 

Hope this is the information you were after.

@lucioxiii 

If that's PivotTable shown in initial post, when creating PivotTable add data to data model and play with explicit DAX measures instead of default implicit aggregation.  Basic is here Use of RANKX in Power BI measures - SQLBI, rest depends on concrete model.

Thank you, that helps with getting the Ranks however, how do I go about adding the column that will evaluate the ranks and count the number of times an item has appeared in top 5 for the last 4 weeks?