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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.