Please help me with this formula. I know I need to create a table containing my holidays and link the table to my date table. How do I write the dax formula to put a 0 in all weekends and holidays?
Yes, I am embarrassed to even show you my work around.
WorkingDays =
IF (
OR ( DateDimension[DayOfWeek] = 7, DateDimension[DayOfWeek] = 1 ),
0,
IF (
DateDimension[Date] = VALUE ( β01/01/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β01/02/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β03/30/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β05/28/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β07/04/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β09/03/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β11/22/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β11/23/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β12/25/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β12/26/2018β ),
0,
IF (
DateDimension[Date] = VALUE ( β01/02/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β04/14/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β05/29/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β07/04/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β09/04/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β11/23/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β11/24/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β12/25/2017β ),
0,
IF (
DateDimension[Date] = VALUE ( β12/26/2017β ),
0,
IF ( DateDimension[Date] = VALUE ( β12/31/2017β ), 0, 1 )
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
First i really think you should have a separate table is excel or somewhere similar that you can update very easily with the holiday dates.
Then you would have this as a stand alone table. You could then use a LOOKUPVALUE function in a new column within your date table, that looks at the current date and then looks up whether itβs in the holiday table.
Once you have this column itβs a simple IF function.
Hopefully that makes sense. See how you go with this.
I really donβt like the use of the formula there with all the dates. Thereβs to much up keep and not enough continuity in my opinion compared to keeping a simple table that just records all the future holiday dates.
I did this based on what Sam suggested. I linked to a excel sheet which has only one column, my holiday dates. I added a new column to my date table called βHolidayβ. Then I created my final column called βWorkdayβ. Getting holidays to show as 0 was my main goal.