I am not getting it right with the week numbers in Power Automate. I tried...
add(div(dayOfYear(outputs('Date')),7),1) - it gives week 31 for Friday 29th of July 2022. It's week 30. It works for 2020.
div(dayOfYear(outputs('Date')),7) - it gives week week 30 for Wednesday 29th of July 2020. It's week 31. It works for 2022.
In another thread I found a calculation to find weeks between dates from @ccc333ab. This has worked for all years I have tried:
add(div(div(sub(ticks(outputs('Date')),ticks(formatDateTime(outputs('FirstDateOfYear'),'yyyy-MM-dd'))),864000000000),7),1)
For the FirstDateOfYear:
concat(formatDateTime(outputs('Date'),'yyyy'),'-01-01')
If you need to find the Monday of the Date you can use this formula in the compose of Date:
subtractFromTime(outputs('ActualDate'), if(equals(dayofweek(utcNow()),0),6,sub(dayofweek(outputs('ActualDate')),1)), 'Day')
Grateful for this community 🙂