Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello, I've spent a ton of hours trying to find an answer to this problem, but there doesn't seem to be any as far as I can tell.
My goal is to create a column that identifies if the date is a working day. The issue is that I can't seem to extract the date for the day after Thanksgiving for each year. Here's what I have:
I have a date table spanning from 2020-2029.
I have a holiday table that contains a column for the dates of major US holidays and a column labeling those holidays.
I was able to get the holidays over to the date table with the lookupvalue function, but I also need to identify the day after thanksgiving. I know I could just manually look up the dates and insert them, but I wanted to see if there was a more automated method to doing this.
On a related note, is there a way of comparing a column from the date table to a range of values from a column in the holiday table. Not all of the major holidays are counted as "company holidays" so I really wanted to do something along the lines of:
WorkingDay = IF('DateTable'[Holiday] = ("Memorial Day", "Thanksgiving Day", etc), 0, 1)
where the red font would be the list of specific holidays. I know I could do this with the switch function or repeat a bunch of ||, but I figured I'd ask you all if there's a shorter alternative.
Thanks in advance!
Solved! Go to Solution.
what you are looking for is the "IN" keyword. Note it needs curly bracket, unlike in SQL.
WorkingDay = IF('DateTable'[Holiday] IN {"Memorial Day", "Thanksgiving Day", etc}, 0, 1)
your other question is difficult to answer without seeing the data model.
Thanks everyone for all the resources!
@lbendlin I did think about the IN operator, but wasn't able to get it to work. I did find a way to get around it.
As for the first issue, I settled on a solution that required me to create a calculated column to pull in the day after Thanksgiving on the holiday table. Then it was easy to use that column to identify the day after Thanksgiving on the date table.
DayAfterThanksgiving Date = IF( 'Holiday'[Holiday] = "Thanksgiving Day", 'Holiday'[Date]+1, Blank() )
Hi @Anonymous ,
See if this helps.
https://community.powerbi.com/t5/Desktop/Public-Holiday-Script/td-p/178341
https://community.powerbi.com/t5/Power-Query/Excluding-School-holidays-from-date-count/m-p/962281
https://community.powerbi.com/t5/Desktop/Dynamic-Holiday-Calendar/m-p/866747
You basically need to create a Holiday Table and a Column for your Company Holiday and comapare the two Column.
The above link compares Holidays with Weekend, you would need to compare your Company Holidays with all the Major Holidays
Hope this helps.
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
@Anonymous , refer these two
https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-3-public-holidays
https://www.andredevelopment.com/en-US/community/blogs/powerbi/working-days-holidays-calendar/
what you are looking for is the "IN" keyword. Note it needs curly bracket, unlike in SQL.
WorkingDay = IF('DateTable'[Holiday] IN {"Memorial Day", "Thanksgiving Day", etc}, 0, 1)
your other question is difficult to answer without seeing the data model.
User | Count |
---|---|
47 | |
27 | |
23 | |
18 | |
15 |
User | Count |
---|---|
55 | |
34 | |
18 | |
17 | |
15 |