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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
adelimont
Regular Visitor

Rank top 10 data within each month

I'm new to Power BI and DAX and I haven't been able to find a solution to my problem.

 

I have a table organized with Job #, Month, Data. I would like to be able to add a column to rank the data within each month. Then when selecting a specific month in my visuals I can see the ranking for the data for that month.

 

Table name is '2018 YTD'.

 

Job example.JPG

 

So far I haven't been able to use the FILTER function to get a usable result. I can get the rank of all the data in the REVENUE column, but I can't get it broken down by month so that each month has a ranking of 1 through 10.

 

Rank Revenue by Month = if(rank.eq('2018 YTD'[Revenue],'2018 YTD'[revenue],DESC)<11,rank.eq('2018 YTD'[Revenue],'2018 YTD'[Revenue],DESC),0)

 

Thank you for your help!

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

HI @adelimont

 

Try this column

 

Rank Revenue by Month =
RANKX (
    FILTER ( 'YTD', 'YTD'[Month] = EARLIER ( 'YTD'[Month] ) ),
    'YTD'[Revenue],
    ,
    DESC,
    DENSE
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Phil_Seamark
Employee
Employee

Hi @adelimont

 

This calculated column will be pretty close.  Let me know if you would like this as a calculated measure

 

 

Rank Revenue as Column = 
     RANKX(
            FILTER(
                '2018 YTD',
                '2018 YTD'[Month] = EARLIER('2018 YTD'[Month])),
            '2018 YTD'[Revenue]
            )

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Zubair_Muhammad
Community Champion
Community Champion

HI @adelimont

 

Try this column

 

Rank Revenue by Month =
RANKX (
    FILTER ( 'YTD', 'YTD'[Month] = EARLIER ( 'YTD'[Month] ) ),
    'YTD'[Revenue],
    ,
    DESC,
    DENSE
)

Regards
Zubair

Please try my custom visuals

Thank you @Zubair_Muhammad and @Phil_Seamark so much for the quick responses! This seems to be working!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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