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
macas01
Frequent Visitor

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

@macas01 

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

@macas01

I am confused with your logic1.PNG





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

Proud to be a Super User!




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!

 

@macas01 

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!




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!

@macas01 

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) .

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

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.