cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Events Correlation

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?

2 REPLIES 2
Super User

@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

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

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.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors