I see a lot of posts on here about how to calculate the net working days using DAX. However I don't see anyone showing the same solution using M. Reason I want to add this as a column in PowerQuery is so that I can group the results. That's why I need to have a column that I can apply conditional logic to.
I have a date dimension table called "Date" with a column called "Working Days excl. Holidays" that returns a true or false value on whether it is a working day or not. TRUE = Working Day, FALSE = Not a working day.
I have another table, called "NCReport" that contains the column "NCR_Date" and "Today's Date". Essentially, what I want to do is to add a new column in this table that will calculate the number of working days between "NCR_Date" and "Today's Date", using "Working Days excl. Holidays" = TRUE.
this could probably be solved in much more elegant way, but this is one way of getting the number of workdays
In the NCReport table, add a custom column with this code
and expand this to new rows. This will give you one row for each day between NCR_date and today. From the Home tab, use Merge queries, and merge NCReport with your dimDate on the column you just created. Expand the resulting column, and choose only your WorkingDay column. Then on the transform tab, use Group By, and group NCReport by NCR_date and Today, and for the new column do a sum over the WorkingDay column from the merge. If working day is true/false, you might have to convert it to 1/0 to get the sum to work
Hey Sturlaws, thanks for the suggestion. I see where you're going with this, but I don't think that's going to work as I have tens of thousands of rows already in my NCReport table, in addition, if I'm expanding each row by the number of days between NCR_Date to Today's date. it's going to get to an unmanageable size...