Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
SCNCKS1
Helper I
Helper I

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 (including weekend observations)
        //// When falling on Saturday, move to preceding Friday
        MONTH([Date]) = 12 && DAY([Date]) = 31 && WEEKDAY([Date], 1 ) = 6, "New Year's Day (Observed)",
        //// When falling on Sunday, move to following Monday
        MONTH([Date]) = 1 && DAY([Date]) = 2 && WEEKDAY( [Date], 1 ) = 2, "New Year's Day (Observed)",
        //// When falling on normal workday, do not shift holiday observation
        MONTH([Date]) = 1 && DAY([Date]) = 1 && WEEKDAY([Date], 1 ) IN { 2, 3, 4, 5, 6 }, "New Year's Day",
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

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 ""

Screen Capture #1409.png

View solution in original post

1 REPLY 1
Ahmedx
Super User
Super User

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 ""

Screen Capture #1409.png

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.