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

Announcements

News and Announcements icon
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,396 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
    12,101 Super User 2026 Season 1 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 468

#2
Haque Profile Picture

Haque 370

#3
Valantis Profile Picture

Valantis 354

Last 30 days Overall leaderboard