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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Ski900
Helper II
Helper II

How to visualize the top N count of categories, where the category label is distinct for each month

I have a table that has the following information (Month Year is connected to a date dimension):

 

Month Year       Category

Jan 2018            A

Jan 2018            A
Jan 2018            B

Jan 2018            C

Jan 2018            C
Feb 2018           D            
Feb 2018           B

Feb 2018           B

Feb 2018           D

Feb 2018           D

 

What I am trying to show is the top 2 categories for each month by count. So it would look like this:

 

Month Year       Category       Count of Category

Jan 2018            A                   2

Jan 2018            C                   2

Feb 2018           B                   2    

Feb 2018           D                   3

What is making this tricky is visualizing it. In Jan 2018 we have category A & C and in Feb 2018 we have category B & D. When I try to visualize it by adding Category to the legend and selecting the Top 2 by count, it selects the Top 2 of all categories of the entire set, and not Top 2 by individual month. I understand why the bar chart visuals are behaving this way, I'm wondering if there is a work around so I can show the top categories for each month? Hopefully I have explained this so it's easy to understand the problem, but please let me know if you would like further clarification. I can also provide code of what I have attempted to do to solve this problem if you would like to. Thanks!

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

I believe this is the result you want.  Download the PBI file from here.

 

Hope this helps.

 

Untitled.png


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

Thank you very much! I am able to actually accomplish this aspect. What I am having trouble with is visualizing this in a bar chart. For example, let say I put it into a bar chart with Month Year in the axis, Count in the values, and Category in the legend. Then I filter Category by Top 2 of Count. The bar chart will show the top 2 categories for all time only, but what I would like to visualize is the top 2 categories per month. Hopefully this clears it up.  

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors