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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PowerBIUser27
Helper I
Helper I

How to write measure for Cumulative % Total - without Date column, in combo chart?

Hello! I have some factory machine data here, visualized in the chart below:

 

PowerBIUser27_0-1701635279745.png

This visualizes how many hours the machine is "down" (see Y-axis), and then what alarm code (See X-axis) the machine said caused the "down" status. This way, I can tell what alarms are getting triggered most often.

 

This data is recorded in three simple columns, see example data below. Downtime (seconds) is cumulative, as you can see. Alarm Code outputs null when the machine is not down.

TimeDowntime (seconds)Alarm Code
11/1/23 1:00:00 PM0

null

11/1/23 1:00:30 PM304

11/1/23 1:01:00 PM

60

4

11/1/23 1:01:30 PM

90

4

11/1/23 1:02:00 PM

90

null

11/1/23 1:02:30 PM

120

5

11/1/23 1:03:00 PM

150

5

11/1/23 1:03:30 PM

180

5

 

In this example data, Alarm Code 4 occurred for 90 seconds. Then, Alarm Code 5 occurred for another 90 seconds. Again, Downtime is cumulative.

 

To create the visual above, I wrote a simple Max() - Min() measure for downtime. This subtracts the earliest downtime from the latest, giving the number of seconds that "down" session occupied. When I put that into the visual as the Y-axis, then add Alarm Code as the X-axis, you see the chart above.

 

However, the client requested I add a Cumulative % of Total line to this column chart, see example below:

PowerBIUser27_1-1701635982678.png

This would allow them to easily see how many Alarm Codes take up 80% of the Downtime. I have done my research and cannot find a way to create this anywhere - all solutions I found utilize a Date column or do not apply to this use case.

 

Any guidance is greatly appreciated, thank you!

 

2 REPLIES 2
amitchandak
Super User
Super User

@PowerBIUser27 , Try a measure for % of Cumm Total

 

Cumm Based on Date = Divide( CALCULATE(Sum(Table[Downtime (seconds)]) , Window(1,ABS,0,REL, allselected('Table'[Time]),ORDERBY('Table'[Time]),ASC)) , CALCULATE(Sum(Table[Downtime (seconds)]) ,allselected()))

 

 

refer, if needed

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Thank you for the reply! I edited your code to reflect my columns, and get the following error:

PowerBIUser27_0-1701709531361.png

I've never seen that Window function before, so I'm not sure how to fix.

 

And I do already have a measure calculating Downtime in hours, which takes the Max-min of Downtime to provide the correct number. Can that measure be used in this formula?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.