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,
I just got a request to build a date slicer that "aligns workdays over months", what I mean by this is that if 16 workdays has passed in the current month, the slicer should filter the date table to only show 16 work days in all the previous months as well. The purpose is to make it easier identifing trends in the sales data if you can easily see that "16 days in to May we sold x amount and now in November we sold y amount".
Another problem is of course that the number of days differ between months so somehow you need to incorporate the % of passed workdays as a share of total workdays that specific month.
It could be added directly in to the date table using m-code or with calculated columns, the main goal is to get the functionality that I am describing. Or maybe there are completely other ways to get the functionality I am after.
It would be a really good feature to have a slicer like this but I don't really know where to start with this task to be honest, I have searched around but I have not found any information about this. Has anyone else built something similar and/or have any input on how this can be done?
Thanks in advance!
Solved! Go to Solution.
Hi @Jodallen123
To create a workday-aligned date slicer that works across months in Power BI, follow these steps:
Create a Date Table:
Add Workday Column:
WorkdayFlag = IF(WEEKDAY([Date], 2) <= 5, 1, 0) // Assumes weekends are non-workdays
CumulativeWorkdays = CALCULATE(COUNTROWS('DateTable'), FILTER('DateTable', 'DateTable'[Date] <= EARLIER('DateTable'[Date]) && 'DateTable'[WorkdayFlag] = 1))
TotalWorkdaysMonth = CALCULATE(COUNTROWS('DateTable'), FILTER('DateTable', 'DateTable'[Month] = EARLIER('DateTable'[Month]) && 'DateTable'[WorkdayFlag] = 1))
WorkdaysPassedPercentage = 'DateTable'[CumulativeWorkdays] / 'DateTable'[TotalWorkdaysMonth]
Build the Slicer:
Adjust the Data:
This setup allows you to filter data by workdays and easily compare the same number of workdays across different months.
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Please Subscribe my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
Hi @Jodallen123
To create a workday-aligned date slicer that works across months in Power BI, follow these steps:
Create a Date Table:
Add Workday Column:
WorkdayFlag = IF(WEEKDAY([Date], 2) <= 5, 1, 0) // Assumes weekends are non-workdays
CumulativeWorkdays = CALCULATE(COUNTROWS('DateTable'), FILTER('DateTable', 'DateTable'[Date] <= EARLIER('DateTable'[Date]) && 'DateTable'[WorkdayFlag] = 1))
TotalWorkdaysMonth = CALCULATE(COUNTROWS('DateTable'), FILTER('DateTable', 'DateTable'[Month] = EARLIER('DateTable'[Month]) && 'DateTable'[WorkdayFlag] = 1))
WorkdaysPassedPercentage = 'DateTable'[CumulativeWorkdays] / 'DateTable'[TotalWorkdaysMonth]
Build the Slicer:
Adjust the Data:
This setup allows you to filter data by workdays and easily compare the same number of workdays across different months.
Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Please Subscribe my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
14 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
11 |