cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Error using Max on date within a Calculate

 

i am trying to return a value based on the maximum date the calculation i am using is...

 

max date = CALCULATE( SUM(test[MatchedRate]), max(test[Date]))

 

my error message is "A function MAX has been used in a True/False expression that is used as a table filter expression. this is not allowed".

1 ACCEPTED SOLUTION
Impactful Individual
Impactful Individual

To get the value on the most recent date use the following.

 

Latest by Date =
CALCULATE (
    SUM(test[MatchedRate]),
    FILTER (
        ALL ( test),
        test[Date] = MAX ( test[Date] )
    )
)

If you have multiple items on the last day though it will sum them all. If you just want one line item then you need an chronological Id/Index field.

 

Latest by Index =
CALCULATE (
    SUM(test[MatchedRate]),
    FILTER (
        ALL ( test),
        test[Index] = MAX ( test[Index] )
    )
)

View solution in original post

1 REPLY 1
Impactful Individual
Impactful Individual

To get the value on the most recent date use the following.

 

Latest by Date =
CALCULATE (
    SUM(test[MatchedRate]),
    FILTER (
        ALL ( test),
        test[Date] = MAX ( test[Date] )
    )
)

If you have multiple items on the last day though it will sum them all. If you just want one line item then you need an chronological Id/Index field.

 

Latest by Index =
CALCULATE (
    SUM(test[MatchedRate]),
    FILTER (
        ALL ( test),
        test[Index] = MAX ( test[Index] )
    )
)

View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors