Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello! I have some factory machine data here, visualized in the chart below:
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.
Time | Downtime (seconds) | Alarm Code |
11/1/23 1:00:00 PM | 0 | null |
11/1/23 1:00:30 PM | 30 | 4 |
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:
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!
@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:
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?
User | Count |
---|---|
77 | |
77 | |
67 | |
65 | |
47 |
User | Count |
---|---|
108 | |
105 | |
93 | |
83 | |
64 |