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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ilcaa72
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
Anonymous
Not applicable

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
Anonymous
Not applicable

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] )
    )
)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.