Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Dynamic Holiday Calendar using Power Query not DAX

Hello I have a data that spans from 2019 - 2024. I have used start and end date parameter to create a date table.   The table below is the holiday table and do not want to manually create these da...
  • Anonymous's avatar
    Anonymous
    2 years ago

    I have solved this. by following the steps below. it is pretty long but I had to figure out a way when I got no response.

     

    1. Used the date start and end date to create a date table.

    2. Used the Add column to add weeek of month, month name, day name, Month & Day

    3. I merged columns as follows:

    a. Month and Day

    b. week of month, day name and month

    4. Used conditional column to tell the system when to display any of the above stated holiday names

    5. Given that some of the days were Saturday or Sunday, I added a custom column to replace the date using the logic below:

    a. For Sunday, I used - if Text.Contains ([Day Name],"Sunday") then Date.AddDays([Date],1) else ""

    b. For Saturday, I used - if Text.Contains ([Day Name],"Sunday") then Date.AddDays([Date],2) else ""

    6. I merged #5a&b

    7. Used Conditional column to replace all null dates with date column and others with value from #6.

    Please ensure to always convert these actions to date