Forum Discussion
SharePoint Online Date calculation with JSON
- Jul 06, 2020
Hi JamesMWood you can do this with a simple flow in Power Automate. The columns are StartDate (DateTime), WarrantyYears(Number) and WarrantyExpiryDate (DateTime). When an item is created or modified in your SharePoint list we calculate the number of warranty days (years x 365), convert that to an integer and then add those days to the start date. Finally we update the SharePoint item with the warranty expiry date:
I always like to split up my Compose controls so that it's easy to see what each one is doing, but you could combine them if you wished to. The expressions in each Compose are shown in the comments.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Hi JamesMWood you can do this with a simple flow in Power Automate. The columns are StartDate (DateTime), WarrantyYears(Number) and WarrantyExpiryDate (DateTime). When an item is created or modified in your SharePoint list we calculate the number of warranty days (years x 365), convert that to an integer and then add those days to the start date. Finally we update the SharePoint item with the warranty expiry date:
I always like to split up my Compose controls so that it's easy to see what each one is doing, but you could combine them if you wished to. The expressions in each Compose are shown in the comments.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
RobElliott I think I have worked out what is going on. Although I am not sure why it is causing issues the SharePoint list was originally an excel file with all of the same columns, which I imported into sharepoint using the app to create a list from an excel. As soon as I create the date and duration columns in SharePoint the calculations work, I am not sure why but I assume that the import app has brought in some weird formatting from excel.
So I can happily report that your solution works