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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JohnHS
Frequent Visitor

Find the value from a related column for an aggregate?

In this case I want to find the date of the Max value of a Sum agregation.

 

In my example DevAdvance = Sum(Development[ADVANCE]) and the DateKey is from a Calendar table

where MAXX('Calendar',[DevAdvance]) = 57

I can see that the Max DevAdvance was on the 11-Apr-20 how can I return that date?

Annotation 2020-07-02 090028.jpg

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Not sure what context you are going to use this measure, but you could try an approach like this.

 

Date with Max =
VAR __summary =
    ADDCOLUMNS ( VALUES ( 'Calendar'[DateKey] ), "@DevAdvance", [DevAdvance] )
VAR __maxdevadv =
    MAXX ( __summary, [@DevAdvance] )
VAR __filtered =
    FILTER ( __summary, [@DevAdvance] = __maxdevadv )
RETURN
    MAXX ( __filtered, 'Calendar'[DateKey] )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Not sure what context you are going to use this measure, but you could try an approach like this.

 

Date with Max =
VAR __summary =
    ADDCOLUMNS ( VALUES ( 'Calendar'[DateKey] ), "@DevAdvance", [DevAdvance] )
VAR __maxdevadv =
    MAXX ( __summary, [@DevAdvance] )
VAR __filtered =
    FILTER ( __summary, [@DevAdvance] = __maxdevadv )
RETURN
    MAXX ( __filtered, 'Calendar'[DateKey] )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Works perfectly thank you.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.