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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
swandernoth
Regular Visitor

Merge consecutive time intervals

Hi everyone,

 

I'm trying to merge some rows of a table based on consecutive time intervals. My table looks something like this:

 

 

Start DateEnd DateValue
01/01/202202/01/202210
02/01/202204/01/202210
04/01/202205/15/202210
05/15/202206/01/202220
06/01/202208/13/202220
08/13/202209/01/202220
09/01/202210/31/202220
10/31/202212/24/202210
12/24/2022  01/10/2023  10
01/10/202303/27/202310

 

I would like to merge the rows within each block of similar values in the "value" column, so that the result looks like:

 

 

Start DateEnd DateValue
01/01/202205/15/202210
05/15/2022  10/31/2022  20
10/31/202203/27/202310

 

A simple 

 

 

 

 

GROUPBY(table, [Value], "Start Date Merged", MINX(CURRENTGROUP(), [Start Date]), "End Date Merged", MAXX(CURRENTGROUP(), [End Date]))

 

 

 

 

 doesn't work because the values in "Value" are not unique outside the blocks I want to merge.

 

Any help with this would be greatly appreciated, as I have been trying to wrap my head around this for quite some time.

 

Thanks!

1 REPLY 1
amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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