Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
71 | |
57 | |
38 | |
36 |
User | Count |
---|---|
83 | |
67 | |
62 | |
46 | |
45 |