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
sqaar__
Helper I
Helper I

Duration from one date filterd by category and value

Hello Community! 


I have signal data from the machine and need to do a spectrum of work time for each machine.

The table contains, the name of the machine, status 0/1 ( downtime/working), and Data with time.

What i need is time how long was value 0 before it change to 1 (its downtime) and also the duration from 1 to 0 (work time)


I tried to implement the Lag & Lead solution but it fails, also I did it in power query duration, but it was very slow - the table contains millions of rows.

Could you recommend a DAX solution for this one which will work very fast?

 

Part of the table below:

sqaar___0-1674657356645.png

 

Thank you so much, all hints are appreciated. 

 

Best,

Patryk

 

2 REPLIES 2
Anonymous
Not applicable

Downtime = CALCULATE( SUMX(FILTER(ALL(Table), Table[Status] = 0), Table[Duration]), FILTER(ALL(Table), Table[Status] = 0) )
Try this 🙂 

Hi @Anonymous 

 

Thank you so much for your answer:) 
Unfortunately, I don't have a duration column here. It's the main issue here, to count duration correctly. 
It can't be the previous row, after sorting by time, cause still need to filter other machines.

Any other ideas?

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.