Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

M code for dynamic week in Power Query

Dear all, I'm facing issue with M code for dynamic week in Power Query, appreciate your advice. I create a M code to define week# based on the current date as below. There is not issue to define th...
  • mahoneypat's avatar
    mahoneypat
    5 years ago

    Here is modified version that should do that

     

    = let date1 = Date.AddWeeks(Date.From(DateTime.LocalNow()), -25) in Number.ToText(Date.Year(date1)) & Text.PadStart(Number.ToText(Date.WeekOfYear(date1)),2,"0")

     

    Pat