cancel
Showing results for
Did you mean:
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:

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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Personal Budget Most Earned In A Month Using RankX

@hnguy71

Try this pattern

```Best_Month Measure =
MAXX (
TOPN ( 1, VALUES ( Transactions[Month] ), [03_Most_Earned_In_Month], DESC ),
[Month]
)
```
3 REPLIES 3
Super User

## Re: Personal Budget Most Earned In A Month Using RankX

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

### I have book! Learn Power BI from Packt

Proud to be a Datanaut!

Super User

## Re: Personal Budget Most Earned In A Month Using RankX

@hnguy71

Try this pattern

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

## Re: Personal Budget Most Earned In A Month Using RankX

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!

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 400 members 3,495 guests
Recent signins: