Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
buttercream
Helper II
Helper II

RankX help

I'm trying to find the product with the highest number of rows for each date.  What would be the best way to change:

 

This table:

MonthProduct
Sep'24A
Sep'24B
Sep'24A
Sep'24A
Sep'24A
Aug'24B
Aug'24B
Aug'24B
Aug'24A

 

To this:

MonthTop ProductCount
Sep'24A4
Aug'24B3
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725501631565.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, @buttercream 

You can also try the following DAX expressions to create a new table

 

TopProductTable = 
VAR _vtable = SUMMARIZE(
    'Table',
    'Table'[Month],
    'Table'[Product],
    "_Count", COUNT('Table'[Product])
)
RETURN 
SELECTCOLUMNS(FILTER(ADDCOLUMNS(_vtable,"_A",MAXX(FILTER(_vtable,'Table'[Product]=EARLIER('Table'[Product])),[_Count])),[_Count]=[_A]),'Table'[Month],'Table'[Product],[_Count]
)

 

 

Here is my preview:

vyohuamsft_0-1725515821539.png

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725501631565.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks.  This works.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@buttercream Well, you could put Month and Product in a table visual and then simply:

Measure = COUNTROWS( 'Table' )

 

Or you could create a table like:

Table1 = SUMMARIZE( 'Table', [Month], [Product], "Count", COUNTROWS( 'Table' ) )



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

That gives me the count for each product for each month.  How do I get the top product in each month only?  Sep'24 should only show A with 4.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.