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
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
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.