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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hnguy71
Memorable Member
Memorable Member

Personal Budget Most Earned In A Month Using RankX

Good afternoon!

 

I'm building a personal budget report and one key component is to determine what is the most I've earned in a month (filtering only for payroll). I am able to use rankx and show my top ranking months between years but my end result that I'm looking for is just one datamined amount. My current dax formulas is as followed:

 

03_Most_Earned_In_Month = 
var GetRanks = CALCULATE(RANKX(ALL(Transactions[Month]), [02_Sum_All_Credit],,DESC), Transactions[Category] = "Payroll")
return
CALCULATE([02_Sum_All_Credit], FILTER(Transactions, GetRanks = 1), Transactions[Category] = "Payroll")

With this I am able to get this result:

current_results.PNG

 

I will be placing the result in a multi-row card to display the year and month that has only the highest amounted result:
desired_result.PNG

I tried using TopN on top of the RankX but I'm unable to get my desired result. Any help would be appreciated! Thanks!



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
1 ACCEPTED SOLUTION

@hnguy71

 

Try this pattern

 

Best_Month Measure =
MAXX (
    TOPN ( 1, VALUES ( Transactions[Month] ), [03_Most_Earned_In_Month], DESC ),
    [Month]
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Why not just take away your Year context and then perhaps do a LOOKUPVALUE to retrieve year for that specific amount and month?


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@hnguy71

 

Try this pattern

 

Best_Month Measure =
MAXX (
    TOPN ( 1, VALUES ( Transactions[Month] ), [03_Most_Earned_In_Month], DESC ),
    [Month]
)

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad 

Thanks for your help! It was just the help I needed! I ended up transforming your measure into something larger but the idea was essentially there! 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.