The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I'm trying to obtain a graph but I've couldn't find how to resolve it.
I have data from electronic failures of machinery. Basically, it's a table like this:
Asset | Datetime | Event |
Asset 1 | 01-01-2023 12:30:00 | Engine Overspeed |
Asset 2 | 02-01-2023 01:54:00 | Engine Oil Low Pressure |
Asset 1 | 02-01-2023 17:12:00 | Transmission Abuse |
Asset 1 | 02-01-2023 18:20:00 | Transmission Oil High Temperature |
Asset 2 | 03-01-2023 16:34:00 | Engine Overspeed |
Asset 1 | 03-01-2023 16:35:00 | Engine Coolant High Temperature |
Asset 2 | 03-01-2023 16:35:30 | Engine Coolant High Temperature |
I want to count how many events happened at the same time or after each one of them by asset, in a certain window of time.
The goal of this is to obtain a matrix where I can see the correlation of events, where, by each event a certain amount of % of other event also happen in that window of time.
Example:
In the window of 24 hours, after one event of Engine Overspeed, it only occurs 0.5 events of Engine Coolant High Temperature. Why?
Because after the Engine Overspeed in Asset 1 seen at 01-01-2023 12:30:00, it doesn't happens anything else on the same asset within 24 hours, And, after the Engine Overspeed in Asset 2 seen at 03-01-2023 16:34:00, it only happens 1 event of Engine Coolant High Temperature in the same asset. So, by 2 events of Engine Overspeed, we can count 1 event of Engine Coolant High Temperature.
The resulting matrix in this example would look like this (for a time window of 24 hours):
Engine Overspeed | Engine Oil Low Pressure | Transmission Abuse | Transmission Oil High Temperature | Engine Coolant High Temperature | |
Engine Overspeed | 1 | 0 | 0 | 0 | 0.5 |
Engine Oil Low Pressure | 0 | 1 | 0 | 0 | 0 |
Transmission Abuse | 0 | 0 | 1 | 1 | 1 |
Transmission Oil High Temperature | 0 | 0 | 0 | 1 | 1 |
Engine Coolant High Temperature | 0 | 0 | 0 | 0 | 1 |
I have no problem to vary the time window being declared as a variable inside the DAX function, but I don't know how to manage the time intelligence for the different assets.
Any idea?
Thanks a lot in advance.
@ChrisCollao This doesn't give the exact results in your matrix but you might be able to tweak the logic to get it the way you want. I'm probably missing something obvious. PBIX is attached below signature.
Measure =
VAR __Window = 1/24
VAR __EventRow = MAX('Events'[Event])
VAR __EventColumn = MAX('Table'[Event])
VAR __Table = SELECTCOLUMNS(DISTINCT('Table'[Asset]), "__Asset", [Asset])
VAR __Table1 = ADDCOLUMNS(__Table, "__RefDateTime", MAXX(FILTER('Table', [Asset] = [__Asset] && [Event] = __EventRow),[Datetime]))
VAR __Table2 = ADDCOLUMNS(__Table1, "__EndDateTime", [__RefDateTime] + __Window)
VAR __Table3 = ADDCOLUMNS(__Table2, "__Occurences", COUNTROWS(FILTER('Table', [Event] = __EventColumn && [Datetime] >= [__RefDateTime] && [Datetime] <= [__EndDateTime])))
VAR __Count = COUNTROWS(__Table3)
VAR __Occurences = SUMX(__Table3, [__Occurences])
VAR __Result = DIVIDE(__Occurences, __Count) + 0
RETURN
__Result
Hi @Greg_Deckler , thanks for your answer,
I've being trying with your proposition but I couldn't obtain the right values 😞 I don't know if it's not properly counting through time window or assets. Will keep trying anyway.
Thanks.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
78 | |
68 | |
52 | |
50 |
User | Count |
---|---|
120 | |
120 | |
76 | |
62 | |
61 |