web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Max Date Time value

(0) ShareShare
ReportReport
Posted on by 678
Why do I get this... it seems accurate to me...

I have a compose titled LastModified and the syntax is...
 
max(body('Filter_array')?['Modified'])

The error is...

Action 'LastModified' failed: Unable to process template language expressions in action 'LastModified' inputs at line '0' and column '0': 'The template language expression 'max(body('Filter_array')?['Modified'])' cannot be evaluated because property 'Modified' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

My array from Filter Array is ...
{
    "body": [
        {
            "Date": "16  Dec 24",
            "Role": "TAS; ACD",
            "Modified": "2024-12-11T14:45:29Z",
            "Staff": "9806d058-8f9e-ef11-8a6a-6045bd070466"
        },
        {
            "Date": "17  Dec 24",
            "Role": "TAS; ACD",
            "Modified": "2024-12-11T14:35:20Z",
            "Staff": "9806d058-8f9e-ef11-8a6a-6045bd070466"
        },
        {
            "Date": "18  Dec 24",
            "Role": "TAS; ACD",
            "Modified": "2024-12-11T14:35:21Z",
            "Staff": "9806d058-8f9e-ef11-8a6a-6045bd070466"
        },
        {
            "Date": "19  Dec 24",
            "Role": "TAS; ACD",
            "Modified": "2024-12-11T14:35:21Z",
            "Staff": "9806d058-8f9e-ef11-8a6a-6045bd070466"
        },
        {
            "Date": "20  Dec 24",
            "Role": "TAS; ACD",
            "Modified": "2024-12-11T14:35:22Z",
            "Staff": "9806d058-8f9e-ef11-8a6a-6045bd070466"
        }
    ]
}
Categories:
I have the same question (0)
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    Max function only works on Integers and Decimals. Try this approach.
     
     
     

     
     
     
    This will return you the date with maximum ticks. You will need to convert it back to date.
  • Suggested answer
    Ellis Karim Profile Picture
    11,766 Super User 2025 Season 2 on at
    Hi 
     
    The max function works on a list or array of numbers:
    max(1, 2, 3)
    And return this result: 3
     
    In your case you have an array (a collection) containing multiple properties, such as date, modified and Role etc, and the max function can't work with that.
     
    You could try the following expression which uses the sort function, which sorts a collection in ascending order. This should work as the date is really a string:
     
     
    last(sort(body('Filter_array'), 'Modified'))?['Modified']
     
     
    Ellis Karim

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 392 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 210 Most Valuable Professional

Last 30 days Overall leaderboard