Forum Discussion
Measure\Column calculations not correct
- Anonymous8 years ago
Hi JagThripp,
Maybe you can try to use below formula.
Sample formula of calculate column:
Available workdays = VAR workdayList = FILTER ( CALENDAR ( Table[Created], Table[Updated] ), WEEKDAY ( [Date], 2 ) <= 5 ) //remove weekend VAR holidayList = VALUES ( Holiday[date] ) //holiday list VAR remain = EXCEPT ( workdayList, holidayList ) //workday except holiday RETURN COUNTROWS ( remain )If above not help, can you please share some sample data and holiday table? I will try to coding formula on it.
Regards,
Xiaoxin Sheng
Hi Stachu,
I appreciate your patience with me on this.
I have one more question, is it necessasry to have every day of the week listed in the Holidays table, indicating actual holidays?
Or will the DAX you have provided count all week days and exclude holidays?
I must ask this as the latest snipet you have provided still is not calculating the number of days between the CREATED date and NOW.
I redid the calculation in Excel this morning so the image on the right is what I would expect to see in Power BI.
The image on the left "COLUMN" is the new calculation provided by your good self.
To be honest I would rather not have to add all the dates into the HOLIDAYS table.
Hi JagThripp,
Maybe you can try to use below formula.
Sample formula of calculate column:
Available workdays =
VAR workdayList =
FILTER (
CALENDAR ( Table[Created], Table[Updated] ),
WEEKDAY ( [Date], 2 ) <= 5
) //remove weekend
VAR holidayList =
VALUES ( Holiday[date] ) //holiday list
VAR remain =
EXCEPT ( workdayList, holidayList ) //workday except holiday
RETURN
COUNTROWS ( remain )
If above not help, can you please share some sample data and holiday table? I will try to coding formula on it.
Regards,
Xiaoxin Sheng