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
sdgiss
Helper I
Helper I

DAX to find specific date of max record

I have another question concerning the same dataset as in my post two days ago. I found the all-time max speed of the racers with the following DAX formula (big thanks to the MS Power Bi community!). I am able to report each unique max value in my daiiy report with a date filter.

 

Max Sp-ALL-TIME :=
IF (
    [Max Sp-DAILY],
    CALCULATE (
        MAX ( fData[Max Speed] ),
        FILTER ( ALL ( dDate ), dDate[Date] )
    )
)

 

I am now trying to report (daily) the date of each individual all-time max (with a date filter). The following solution was found inside the comments section of a Power Pivot Pro blog post written by Reid Havens. Without a date filter the output is perfection. Unfortunately when reporting values for a specific date the solution falls apart for me.

 

Max Sp-MAX Date :=
IF (
    NOT ( ISBLANK ( [Max Sp-DAILY] ) ),
    MAXX (
        TOPN (
            1,
            ADDCOLUMNS ( VALUES ( dDate[Date] )"MAX SPEED DATE", [Max Sp-DAILY] ),
            [MAX SPEED DATE]
        ),
        dDate[Date]
    )
)

 

The output with a date filter is on the left, and without a date filter on the right.

Screen Shot 2020-10-27 at 9.14.28 PM.png

 

Thank you all in advance for the assistance!

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

@sdgiss try change VALUES ( dDate[Date] ) to ALL ( dDate[Date] )

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

@sdgiss try change VALUES ( dDate[Date] ) to ALL ( dDate[Date] )

Thank youu @wdx223_Daniel! I should have used your reply from my previous post as a reference!

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.

Top Solution Authors