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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NorbertG
Helper I
Helper I

Not counting things which happen when other action is happening

Hey everyone.
I want to sum up 'downtime'[value] only for those records which do not occur while other downtimes were happening
Example. (working with the same date)Downtime was happening since 15:10 to 15:15, so the value of downtime is 5, but during that downtime, another downtime happend since 15:12 to 15:14, so the value of the downtime is 2, I want the sum of those downtimes to be 10, because one of those downtimes happened while other was occuring.
Here is my table

iddatetime_starttime_endvaluerealization_id
111.08.202310:5010:5558888
215.08.202312:3412:3518889
315.08.202313:0513:1058889
416.08.202320:0520:1058890
516.08.202320:0020:20208890
1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

You mean you get incorrect totals? For this, create a second measure

result = SUMX ( VALUES ( downtime[id] ), [downtime_res] )

ERD_0-1694592315589.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

7 REPLIES 7
ERD
Community Champion
Community Champion

@NorbertG , you can try this measure:

 

downtime_res =
VAR dt = MAX ( downtime[date] )
VAR min_time =
    CALCULATE ( MIN ( downtime[time_start] ), downtime[date] = dt, ALL ( downtime ) )
VAR max_time =
    CALCULATE ( MAX ( downtime[time_end] ), downtime[date] = dt, ALL ( downtime ) )
RETURN
    CALCULATE (
        SUM ( downtime[value] ),
        downtime[time_start] = min_time || downtime[time_end] = max_time
    )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

It does not seem to work. I checked it and it summed values up to 10 for downtimes which happened: 9:23-9:28, 11:26-11:31, 11:53-11:58

ERD
Community Champion
Community Champion

You mean you get incorrect totals? For this, create a second measure

result = SUMX ( VALUES ( downtime[id] ), [downtime_res] )

ERD_0-1694592315589.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Ah yes, now it works as it should

I checked it again and as a matter of fact it returns blank value

DataNinja777
Super User
Super User

Hi @NorbertG,

Did you mean, the downtime was 5 minutes instead of 10?  Please confirm this point for me to better understand your requirement.  

Ah yes, my bad. Let me edit my post really quick

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (4,564)