Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi everyone,
I have two date columns in Power BI (Site Version Date, Country Version Date). How should I calculate the number of working days between these two columns? Thank you!
I also set up a calendar table but I'm not sure if this table is neccessary.
Solved! Go to Solution.
@JovieZ , First create a date table using below DAX go to modelling click on new table
DateTable =
ADDCOLUMNS (
CALENDAR (MIN('YourTable'[Site Version Date]), MAX('YourTable'[Country Version Date])),
"IsWorkingDay",
IF (
WEEKDAY ( [Date], 2 ) < 6,
TRUE,
FALSE
)
)
Mark this table as date table
Then create a calculated column in your main table using
WorkingDaysBetween =
VAR StartDate = 'YourTable'[Site Version Date]
VAR EndDate = 'YourTable'[Country Version Date]
RETURN
CALCULATE (
COUNTROWS ( DateTable ),
DateTable[Date] >= StartDate,
DateTable[Date] <= EndDate,
DateTable[IsWorkingDay] = TRUE
)
Proud to be a Super User! |
|
@JovieZ , First create a date table using below DAX go to modelling click on new table
DateTable =
ADDCOLUMNS (
CALENDAR (MIN('YourTable'[Site Version Date]), MAX('YourTable'[Country Version Date])),
"IsWorkingDay",
IF (
WEEKDAY ( [Date], 2 ) < 6,
TRUE,
FALSE
)
)
Mark this table as date table
Then create a calculated column in your main table using
WorkingDaysBetween =
VAR StartDate = 'YourTable'[Site Version Date]
VAR EndDate = 'YourTable'[Country Version Date]
RETURN
CALCULATE (
COUNTROWS ( DateTable ),
DateTable[Date] >= StartDate,
DateTable[Date] <= EndDate,
DateTable[IsWorkingDay] = TRUE
)
Proud to be a Super User! |
|
User | Count |
---|---|
77 | |
76 | |
44 | |
30 | |
26 |
User | Count |
---|---|
97 | |
91 | |
52 | |
47 | |
46 |