Logic Apps. Setting some date logic. Always reset the date to the Monday (Unless it is Monday)

Debbie Edwards 521 Reputation points


We want to collect Forms data via Logic Apps in Azure for Power BI reports, which means that we can use Forms and trigger When a new response is submitted to collect the information

However, instead of just collecting the date, is there a way in Logic Apps that will take the date, Say 15/12/2020 and reset this to the Monday 14/12/2020 as it comes through

If there is any code we could add to the date field that changes it to the Monday that would be really useful. Normally we would do this in Power Query Editor but obviously if we are just direct querying this data as it comes in, it would be good to use Logic Apps for these kinds of transformations

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,829 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nasreen Akter 10,736 Reputation points

    Hi anonymous user,

    Thank you for asking this question. Sure, you can reset the date in LogicApp. There is a function dayOfWeek('<timestamp>') which can be used to get an integer number i (i.e., 0 -> Sunday --- 6 -> Saturday), then based on this number, e.g., from i = 2 to 6, you can use -(i-1) as <days> in the addDays('<timestamp>', <days>, '<format>'?) function and for 0 use +1 as <days> in the addDays('<timestamp>', <days>, '<format>'?) function to calculate the Monday's date.


    Please let me know if this helps. If it does, please don't forget to "accept the answer" and "up-vote"! Thank you!

    1 person found this answer helpful.
    0 comments No comments