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.
Hi Everyone,
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.
Scenario:
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.
Thanks in advance for your help!
Hi,
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
=List.Numbers([NCR_date],[Today]-[NCR]+1)
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...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
76 | |
63 | |
51 | |
48 |
User | Count |
---|---|
204 | |
86 | |
64 | |
59 | |
56 |