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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jenmar2023
Helper I
Helper I

How to display Top 10 by month in a table / matrix

I have a table called Forms.  Within that table, I have a field called forms, Total and YearMonth. 

 

FormsTotalYearMonth
A10202305
B20202305
C25202305
B20202304
A45202304
C5202304

 

I would like my end result to be a table or some visualization where the user can see The top x forms by month.

For the month of April 202304 the top 3 forms were

A, B, then C

For the month of May 202305 the top 3 forms were 

C, B, then A

 

How can I go about creating doing this in PowerBI? Thank you!

5 REPLIES 5
barritown
Super User
Super User

Hi @jenmar2023,

You don't need any DAX here.

All you need is: 

1) Add a slicer.

2) Add a table visual.

3) Open the Filters pane and use the Top filter there for the [Total] column.

4) Enable sorting by [Total].

barritown_0-1692883539223.png

Hope this helps.

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

The user only sees it one month at a time though? They have to select it each month. Is there a way to show it in a table view all at once?

Okay, in this scenario you'll need some DAX.

 

You could create a calculated column like the one below.

barritown_0-1692888278144.png

 

In plain text:

Top3 Flag = 
VAR CurrentMonth = [YearMonth]
VAR Top3 = CONCATENATEX ( TOPN ( 3, FILTER ( Data, [YearMonth] = CurrentMonth ), [Total] ), [Forms], "," )
RETURN CONTAINSSTRING ( Top3, [Forms] )

 

Once you have it, you should set it to True in the filter pane and sort your table by 2 columns holding the Shift key. Like on the screenshot below:

 

barritown_1-1692888391255.png

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Didn't work. Can't display the visual when I add Top3 flag

 

Here's the file with the mock data where this solution works - https://www.dropbox.com/scl/fi/bemnu8v7a4ahcbpczew60/community-multiple-topx.pbix?rlkey=5ty9flldoh8t...

Please double check with what you do.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors