cancel
Showing results for
Did you mean:
New Member

## Visual that shows the top performing month in a year grouped by year

I am having trouble with the Top 1 filter for a visual that is supposed to show the top performing month by profit and group the collumns by year.

For some reason it will take the top performing month of year 2013 and then the same month from year 2014 (the top performing month for 2014 is December)

I don't understand what I am doing wrong.

1 ACCEPTED SOLUTION
Solution Sage

You can use a DAX measure like this one to get that result. This find the max for all months in the given year and returns blank for all but the max month (and are filtered out in the visual). The visual uses the yearmonth column from my Date table and this measure on the Y axis.

``````Max Month Only =
VAR vThisResult = [Total Qty]
VAR vThisYear =
MAX ( 'Date'[Year] )
VAR vMaxThisYear =
CALCULATE (
MAXX ( VALUES ( 'Date'[YearMonthShort] ), [Total Qty] ),
ALL ( 'Date' ),
'Date'[Year] = vThisYear
)
RETURN
IF ( vThisResult = vMaxThisYear, vThisResult, BLANK () )``````

Pat

Microsoft Employee
Solution Sage

You can use a DAX measure like this one to get that result. This find the max for all months in the given year and returns blank for all but the max month (and are filtered out in the visual). The visual uses the yearmonth column from my Date table and this measure on the Y axis.

``````Max Month Only =
VAR vThisResult = [Total Qty]
VAR vThisYear =
MAX ( 'Date'[Year] )
VAR vMaxThisYear =
CALCULATE (
MAXX ( VALUES ( 'Date'[YearMonthShort] ), [Total Qty] ),
ALL ( 'Date' ),
'Date'[Year] = vThisYear
)
RETURN
IF ( vThisResult = vMaxThisYear, vThisResult, BLANK () )``````

Pat

Microsoft Employee

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors