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
gzzKarlaP
New Member

Calculate time between On and Off Status rows

I have a dataset that logs everytime an equipment gets turn on or off, login its status and the time it was turn on/off. I want to calculate how long its been active by the hour. I want to create 24 columns for each hour and display in there the active time (total minutes that hour). The dataset only logs the current day.  The status represent everytime an equiment has been turn on  (Status 1) or turned off (Status 0). Every row should be a change of status of a given equipment

 

gzzKarlaP_1-1660770259880.png

 

For example:

  • In hour 10:00 it gets turn on at 10:20 and then turn off at 10:45, then it returns 25 minutes.
  • If it doesn't get turn off until 11:20 then in the column of hour 10:00 it will give back 40 minutes, and column of hour 11:00 returns 20minutes
  • If it doesnt get turn off until 12:20 then
    • Column 10 returns 40
    • Column 11 returns 60
    • Column 12 returns 20
  • If there is no log at 9:00 the column return 0

gzzKarlaP_5-1660770431668.png

 
 

gzzKarlaP_4-1660770379632.png

 

mills_logs.csv

 

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi @gzzKarlaP ,

 

Among the data you gave, can you explain how the duration of the 7 is calculated.

vchenwuzmsft_0-1661163246849.png

 


Best Regards

Community Support Team _ chenwu zhu

 

 

danextian
Super User
Super User

Hi @gzzKarlaP ,
Please post a sample data that we can easily manipulate (not an image).





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors