Forum Discussion
Calculated Column for Hierarchical Filtering
I'm attempting to calculate the mean time between events with my data. One aspect of doing this is calculating the difference in time between one event and the next, and having that input as a calculated column.
Thank you for the nice challenge. Here is a universal measure that will work for all dimensions.
MTBF := var a = values(Failures[Date Reported]) var b = ADDCOLUMNS(a,"Previous",var t = [Date Reported] return CALCULATE(max(Failures[Date Reported]),Failures[Date Reported]<t)) var c = filter(b,not ISBLANK([Previous])) return AVERAGEX(c,[Date Reported]-[Previous])see attached.
7 Replies
- lbendlinSuper User
I need this column to work with a hierarchy so that I can dive down in my report and look at the "mean time between events" as mean time in the main system, subsystem, etc. essentially diving through the hierarchy.Calculated columns are immutable. They cannot be influenced by user interaction.
You need to use measures.
- AnonymousNot applicable
Can you assist with what measure would create this? I'm not sure how I can create a measure that calculates the difference between other rows and then averages it.
- lbendlinSuper User
Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523- AnonymousNot applicable
Event Location System Date Reported Failure Pump A Boiler System 5/10/2022 Failure Pump B Boiler System 5/21/2022 Failure Pump A Boiler System 6/10/2022 Failure Pump C Boiler System 6/11/2022 Failure Pump D Condensate System 7/5/2022 Failure Pump E Condensate System 7/10/2022 Given a table of Dates, Locations, and System I would like to create a graph that displays the mean time between events (failures) by system.
I would then like to drill through / filter this graph by system to display mean times between failures by Location. In this instance drilling down "Boiler System".
I'm not sure there's any easy way to accomplish this without requiring two calculated columns.
Time Between Failure (System) Time Between Failure (Location) 0 0 11 0 20 31 1 0 0 0 0 5 I know how to create those calculated columns, but I'd like to be able to have those values change based on what is being filtered out. I.E. the time between events would change if you're just looking at the time between events on "Pump A" vs. time between events on "Boiler System". Since calculated columns are immutable I'm not sure how to achieve this.