This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello everyone,
I have a rather specifc problem I've not been able to solve.
I would like to calculate the number of weekdays that sit between a date range, but the date range is dynamic.
I have the following code as a starting point:
Days Lost =
VAR EndOfPeriod =
MAX ('Date Table'[Date])
VAR StartOfPeriod =
MIN ('Date Table'[Date])
RETURN
SUMX(Absence,
IFERROR(
DATEDIFF(
MAX(Absence[Begin Date],StartOfPeriod),
MIN(Absence[Calculated End Date],EndOfPeriod)
,DAY),0)
)However, this is limited as it also includes weekends. As an added complication I would also like my final measure to treat the dates as inclusive, so if the begin date is equal to the end date then that should be counted as 1 rather than 0.
Any help you can provide would be greatly appreciated.
Many thanks.
Thanks for your reply, unfortunately this isn't quite what I'm looking for. Let me try and clarify a little,
I have a data set including the following columns : Begin Date & Calculated End Date during which a specific event was active.
I would like to produce a graph that has Quarters on the axis, for example Q1 2017, Q2 2017 and so on. For each of these quarters I would like the total number of days spent active, summed over every row of my table.
Say for example my data had two rows:
Start Date Calculated End Date
01/01/2018 01/09/2018
01/02/2018 01/09/2018
My graph with quarters on the axis would show the following total Q1: 107 This would be made up of the 65 weekdays within Q1 from row 1 and the 42 weekdays in Q1 from row 2. For Q2 the graph would show 130, made up of the 65 weekdays in Q2 from row 1, and the 65 weekdays in Q2 from row 2.
I hope this is a little clearer, thanks for your help.
Hi @Phil1,
Just use calendar table(DimDate) join your table with Dim_Date and drag weekdays columns hope this will resove you issue.ion
Please accept this solution if this works for you
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 23 | |
| 22 | |
| 15 |
| User | Count |
|---|---|
| 63 | |
| 45 | |
| 28 | |
| 24 | |
| 22 |