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
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.