cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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!:
Mastering Power BI 2nd Edition

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

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors