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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
francescolar
Frequent Visitor

How to check if row of time ranges overlap with other rows (and multiple condition)

Hi everyone!

I'm new to Power BI!
I'm trying to create a "binary" column that should set the value 1 if two conditions are present simultaneously: the period is overlapped to others in the table (ex. row 1 and 6) and the production period in that row is longer.

As an example of my data.

 

MachineryDateStart_prodEnd_prodMinuts_prodCheck Overlap
A01/02/201901/02/2019 08:0001/02/2019 09:10701
A01/02/201901/02/2019 09:0001/02/2019 09:10100
B01/02/201901/02/2019 08:0001/02/2019 12:002400
B01/02/201901/02/2019 13:0001/02/2019 14:00600
A01/02/201901/02/2019 12:0001/02/2019 13:00600
A02/02/201902/02/2019 08:0002/02/2019 09:10701
A02/02/201902/02/2019 08:3002/02/2019 09:10400


Can you help me please? Thanks in advance!

1 ACCEPTED SOLUTION
francescolar
Frequent Visitor

Autofind solution 🙂

 

Period Overlap =
      VAR Overlapped =
              COUNTROWS(
                      FILTER(
                               ALL(Table);
                               Table[Start_prod] <= EARLIER(Table[Start_prod]) &&
                               Table[End_prod] >= EARLIER(Table[End_prod]) &&
                               Table[Date] = EARLIER(Table[Date]) &&
                               Table[Machinery] = EARLIER(Table[Machinery]) &&
                               Table[Id] <> EARLIER(Table[Id])
                               )
                    )
RETURN
IF(Overlapped; "YES"; "NO")

View solution in original post

1 REPLY 1
francescolar
Frequent Visitor

Autofind solution 🙂

 

Period Overlap =
      VAR Overlapped =
              COUNTROWS(
                      FILTER(
                               ALL(Table);
                               Table[Start_prod] <= EARLIER(Table[Start_prod]) &&
                               Table[End_prod] >= EARLIER(Table[End_prod]) &&
                               Table[Date] = EARLIER(Table[Date]) &&
                               Table[Machinery] = EARLIER(Table[Machinery]) &&
                               Table[Id] <> EARLIER(Table[Id])
                               )
                    )
RETURN
IF(Overlapped; "YES"; "NO")

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.