Hi all,
I need assistance with this, i am importing data from a SharePoint list like this:

Here i have DATE, Well(uniqueID in each date), Responable, Petroleo and Agua.
As you can see there are plenty of items by date, i am trying to make a flow with PowerAutomate which look up for all elements at the last date, then duplicate and finally update that date addind one day. So after the flow, i wish to have this:

As you can see, only was duplicated the items that are in the last date in the list( orange box to green box) and then this date was update adding 1 day more.
I try to create a flow like this:

1.- First get the items:

2.- Then i define an If condition, where just select the items that have the last date in the list:

3. If true, it creates that item, duplicate all values in rows but change the date adding 1 day and added to the same sharepoint list.

These is the code:
{
"type": "Foreach",
"foreach": "@outputs('Get_items')?['body/value']",
"actions": {
"Condition": {
"type": "If",
"expression": {
"and": [
{
"greaterOrEquals": [
"@items('For_each')?['DATE']",
"@last(items('For_each')?['DATE'])"
]
}
]
},
"actions": {
"Create_item": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"table": "afa40198-3621-44a2-afaa-3e76040d490f",
"item/DATE": "@{addDays(items('For_each')?['DATE'],1,'Day')}",
"item/WELL": "@items('For_each')?['WELL']",
"item/Petroleo_x0028_bopd_x0029_": "@items('For_each')?['Petroleo_x0028_bopd_x0029_']",
"item/Agua_x0028_bwpd_x0029_": "@items('For_each')?['Agua_x0028_bwpd_x0029_']",
"item/Gas_x0028_Mpcd_x0029_": "@items('For_each')?['Gas_x0028_Mpcd_x0029_']",
"item/Ptubos_min_x0028_psi_x0029_": "@items('For_each')?['Ptubos_min_x0028_psi_x0029_']",
"item/Ptubos_max_x0028_psi_x0029_": "@items('For_each')?['Ptubos_max_x0028_psi_x0029_']",
"item/Pcasing_min_x0028_psi_x0029_": "@items('For_each')?['Ptubos_min_x0028_psi_x0029_']",
"item/Pcasing_max_x0028_psi_x0029_": "@items('For_each')?['Ptubos_max_x0028_psi_x0029_']",
"item/Plinea_x0028_psi_x0029_": "@items('For_each')?['Plinea_x0028_psi_x0029_']",
"item/Psep_x0028_psi_x0029_": "@items('For_each')?['Psep_x0028_psi_x0029_']",
"item/Timeron_hrs": "@items('For_each')?['Timeron_hrs']",
"item/Timeroff_hrs": "@items('For_each')?['Timeroff_hrs']",
"item/Beam_64": "@items('For_each')?['Beam_64']",
"item/Presion_AB_x0028_psi_x0029_": "@items('For_each')?['Presion_AB_x0028_psi_x0029_']",
"item/Presion_DB_x0028_psi_x0029_": "@items('For_each')?['Presion_DB_x0028_psi_x0029_']",
"item/Carrera": "@items('For_each')?['Carrera']",
"item/SPM": "@items('For_each')?['SPM']"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "PostItem"
}
}
}
},
"else": {
"actions": {}
}
}
},
"runAfter": {
"Get_items": [
"Succeeded"
]
}
}
These is the result:

I get no result, i think that i am defining in bad way tha max date. Can you help me?