Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello!
I can't seem to find the right solution to this.
I have a table (Table 1) which contains a list of cases, target days, and a start date. I wanted to create a column which creates a due date calculated from the start date + target days not including weekends and a list of holiday dates.
In Excel, it was possible to do it as =WORKDAY($A2,$B2,Ref!A:A) (column D) wherein column A = start date, column B = number of days, Ref!A:A = a separate sheet/table with all the holidays manually input.
Table 1 looks like this:
Ref Sheet looks like this:
How do I create a column similar to Table1's column D in Power BI?
EDIT: I would specifically need a new column similar to the Excel formula "=WORKDAY($A2,$B2,Ref!A:A)"
Solved! Go to Solution.
@faustusxanthis Try:
Due Date Column =
VAR __Start = [Start]
VAR __TargetDays = [Target Days]
VAR __Holidays = { DATE(2022,1,1), DATE(2022,12,25) }
VAR __Table =
ADDCOLUMNS(
EXCEPT( CALENDAR(__Start, __Start + __TargetDays * 2), __Holidays),
"__WeekDay", WEEKDAY([Date],2)
)
VAR __Table1 = FILTER(__Table, [__WeekDay] < 6)
VAR __Table2 =
ADDCOLUMNS(
__Table1,
"__Index",COUNTROWS(FILTER(__Table1, [Date] <= EARLIER([Date]))
)
RETURN
MAXX(FILTER(__Table2,[__Index] = __TargetDays),[Date])
You can create a column like
Due date =
VAR StartDate = 'Table'[Start date]
VAR NumDays = 'Table'[Num days]
VAR Result = MAXX( FILTER( VALUES('Date'[Date]), NETWORKDAYS( StartDate, 'Date'[Date]) = NumDays ), 'Date'[Date] )
RETURN Result
You can change the call the NETWORKDAYS to include your holiday table.
This is the greatest answer to the Workday equivalent I have ever seen. Somebody spam this all over all the other overly complicated solutions people come up with, including my own.
How to exclude holidays here in this dax...i have one holiday calender table
@faustusxanthis Try:
Due Date Column =
VAR __Start = [Start]
VAR __TargetDays = [Target Days]
VAR __Holidays = { DATE(2022,1,1), DATE(2022,12,25) }
VAR __Table =
ADDCOLUMNS(
EXCEPT( CALENDAR(__Start, __Start + __TargetDays * 2), __Holidays),
"__WeekDay", WEEKDAY([Date],2)
)
VAR __Table1 = FILTER(__Table, [__WeekDay] < 6)
VAR __Table2 =
ADDCOLUMNS(
__Table1,
"__Index",COUNTROWS(FILTER(__Table1, [Date] <= EARLIER([Date]))
)
RETURN
MAXX(FILTER(__Table2,[__Index] = __TargetDays),[Date])
@Greg_Deckler
Thank you for the prompt response. Just a question though..I have the list of holidays specified in a different sheet/table. How can I reference it in this formula?
VAR __Holidays = { DATE(2022,1,1), DATE(2022,12,25) }
@faustusxanthis Easy,
VAR __Holidays = DISTINCT('Holidays'[Date])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
116 | |
82 | |
47 | |
42 | |
31 |
User | Count |
---|---|
186 | |
80 | |
72 | |
48 | |
45 |