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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Aggregate data based on condition to be computed on raw data

Hello all,

I am pretty new on Power BI and i am working on a report where i need to aggregate data based on some specific conditions:

Here is an example of what i am trying to achive:

 

Screenshot 2021-05-28 at 14.27.31.png

 

 

 

Conditions are

Aggregate/group on continous data (based on timestamp) with 

Start > 90 to End < 20 (taking the lowest End value)

If there are increment ignore (as last case shown on image)

Hope that is clear enough.

 

I have tryied different approach with DAX expression, Visuals, M Query, with descrete results but not exactly what i am looking for. I have tried to find something similar on this Forum but unsuccessfully, i start to think that maybe is not feasable as i want, and i need to change approach.

Do you have suggestions? 

Thanks!

 

Edit 3rd June: Adding sample data:

INPUT

ItemTimestampStartEndDuration
AAA22/05/2021 10:0099564h
AAA22/05/2021 14:0054322h
AAA23/05/2021 01:003271h
AAA24/05/2021 09:0095175h
AAA25/05/2021 11:0083453h
AAA25/05/2021 13:004463h
AAA25/05/2021 17:0091384h
AAA25/05/2021 18:0030141h
BBB22/05/2021 18:0075452h
BBB23/05/2021 08:0093234h
BBB26/05/2021 12:002241h
BBB27/05/2021 12:0094283h
CCC19/05/2021 12:0096582h
CCC20/05/2021 10:0058102h
CCC20/05/2021 13:00541h
CCC24/05/2021 12:0096582h
CCC25/05/2021 10:0058780h
CCC25/05/2021 13:0074123h

 

OUTPUT

ItemTimestampStartEndDuration
AAA22/05/2021 10:009977h
AAA25/05/2021 17:0091145h
AAA24/05/2021 09:0095175h
BBB23/05/2021 08:009345h
CCC19/05/2021 12:009645h

 

1 ACCEPTED SOLUTION

@Anonymous 

Here is a workaround for you, please see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ryan_mayu
Super User
Super User

@Anonymous

I am confused with your logic1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hello ryan,

The previous row start from 95 and end at 17, while next one start from 83 that is greater of previous end (17).

Raw data are ordered by item and by timestamp. Ideally every "process" start from 100 and end at 0.

I would like to isolate and aggregate this "process" accordingly to reqs i wrote in my main post.

Hope that is more clear now.

Thanks!

 

@Anonymous 

Here is a workaround for you, please see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thanks @ryan_mayu it does exactly what i needed! My only concern is regarding the computational load. My full data table size is about 30k/40k rows.

Do you think there could be problem?

Thanks!

@Anonymous 

I am not sure about that, you can have a try. If there is a performance issue, maybe you can ask for help on the community again to see if anyone else can provide better solution.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




lbendlin
Super User
Super User

Please provide sample data in usable format (not as a picture) .

Anonymous
Not applicable

Thanks Ibendlin, i am going to add sample data in main post

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors