Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
hjoubert
Frequent Visitor

Calculate total days from multiple date ranges in another table

Hi everynone, I'm new to DAX and need help calculating total days a checklist was on hold - I have 2 tables, 1. RFI table and 2. Checklist table.

I want to calculate the total days (total networkdays, excluding public holidays and overlaps) from the RFI table per checklist ID and show the total in the Checklist table. This will be used to subtract total on hold days from the total checklist duration to measure statutory performance. The last part is not part of this question, only how to calculate the total on hold days. 

Below an example of the 2 tables.

 

hjoubert_1-1664150916774.png

Thanks Hennie

 

1 ACCEPTED SOLUTION

@hjoubert So like this? Overlap - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
hjoubert
Frequent Visitor

@Greg_Deckler 

Thanks for your reply Greg, your solution is working where all the dates are overlapping but is my example, some of the dates do not overlap. Is there a way of calculating the durations one by one and checking if there are overlaps and then exclude the overlapping parts, but add the durations where the dates do not overlap? Kind regards Hennie

@hjoubert So like this? Overlap - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@hjoubert Put Checklist ID in a table visual along with this measure:

Net Work Days =
  VAR __Start = MIN('Table'[Start])
  VAR __End = MAX('Table'[End])
RETURN
  NETWORKDAYS(__Start, __End, 1, { DATE(2022,12,31), DATE(2023,1,1) }

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for your reply Greg, your solution is working where all the dates are overlapping but is my example, some of the dates do not overlap. Is there a way of calculating the durations one by one and checking if there are overlaps and then exclude the overlapping parts, but add the durations where the dates do not overlap? Kind regards Hennie

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors