Forum Discussion

SCNCKS1's avatar
SCNCKS1
Helper I
3 years ago
Solved

converting dax to M

Hi - I found the code below that will create perpetual holiday for my date calendar in dax, I would like to create the same thing in M (Power query), is this possible?      -- New Year's Day (incl...
  • Ahmedx's avatar
    3 years ago

    pls try this

     

    if Date.Month([Date]) = 12 and Date.Day([Date]) = 31 and Date.DayOfWeek([Date], 1 ) = 6  then  "New Year's Day (Observed)" else if 
            Date.Month([Date]) = 1 and Date.Day([Date]) = 2 and Date.DayOfWeek( [Date], 1 ) = 2 then  "New Year's Day (Observed)" else if
      
    Date.Month([Date]) = 1 and Date.Day([Date]) = 1 and List.ContainsAny({ Text.From(Date.DayOfWeek([Date], 1 ))} , { "2".."6" })= true then "New Year's Day" else ""