Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BjornAadnoy
Regular Visitor

DAX command to pick correct time

Dear all.

I am very new to Power BI but already deeply in love!
We are monitoring equipment onboard a vessel and data is transmitted by default every 5 minutes marked in yellow. In between data is also transmitted every time a man made event occurs such as cabinet door opening stamped with unique event numbers.

My measure event_seconds get event 27 and 29 right but event 28 returns 4 seconds instead of 1. Problem is that To time = max([ts]) captures the max time within each event but I need to capture the time when door_change flips back to 0.

 

Below data source:

Data sourceData source

Below report

timing2.JPG

The above is a Matrix in my report sorted on door_event_no.  I get event_seconds from this measure:

event_seconds = DATEDIFF(min(whitebox_facts[ts]),max(whitebox_facts[ts]),SECOND)

 

Any suggestion on how I can write a measure to capture the time stamp when the first logic 0 occurs after logic 1 in door_change?

 

Sure hope any of this makes sence to you - best regards from west coast of Sweden.

//Björn

1 REPLY 1
JW_van_Holst
Resolver IV
Resolver IV

My best tip is to represent the data in two fact tables. 1) the automatic 2) man made event (best to do this in Power Query). This will give you a cleaner data model and far easier DAX.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.