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,691 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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard