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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
rogerthat
Helper I
Helper I

Consecutive Minutes run and missing days in between

Hi,

 

I'm trying to create the 'CONSECUTIVE MINUTES' column and the 'MISSING DAYS STATUS'

 

CONSECUTIVE MINUTES IS IF THE STATUS REMAINS THE SAME WITHIN THE DAY FOR THE SAME ID, and counting the minutes from the last status if consecutive.

 

'MISSING DAYS STATUS' should be days missing in between any of the status changes. 

 

I'm having a difficulty with this piece and tried using similar approaches.

IDDATTIMETIMESTATUSCONSECUTIVE MINUTESMISSING DAYS STATUS
XYZ3/13/20232:00PMCOMPLETED  
XYZ3/13/20233:30PMCOMPLETED90 
BYZ3/14/20239:00AMINCOMPLETE  
BYZ3/14/202311:00AMINCOMPLETE120 
XYZ3/15/20235:00PMINCOMPLETE 2
BYZ3/17/20239:00AMCOMPLETED 3
4 REPLIES 4
tamerj1
Super User
Super User

Hi @rogerthat 

please try

CONSECUTIVE MINUTES =
VAR CurrentDateTime = 'Table'[DateTime]
VAR CurrentIDDateTimes =
CALCULATETABLE (
VALUES ( 'Table'[DateTime] ),
ALLEXCEPT ( 'Table', 'Table'[ID] )
)
VAR PreviousDateTimes =
FILTER ( CurrentIDDateTimes, 'Table'[DateTime] < CurrentDateTime )
VAR PreviousDateTime =
COALESCE ( MAXX ( PreviousDateTimes, 'Table'[DateTime] ), CurrentDateTime )
VAR Minutes =
DATEDIFF ( PreviousDateTime, CurrentDateTime, MINUTE )
RETURN
IF ( Minutes < 1440, Minutes )

 

MISSING DAYS STATUS =
VAR CurrentDateTime = 'Table'[DateTime]
VAR CurrentIDDateTimes =
CALCULATETABLE (
VALUES ( 'Table'[DateTime] ),
ALLEXCEPT ( 'Table', 'Table'[ID] )
)
VAR PreviousDateTimes =
FILTER ( CurrentIDDateTimes, 'Table'[DateTime] < CurrentDateTime )
VAR PreviousDateTime =
COALESCE ( MAXX ( PreviousDateTimes, 'Table'[DateTime] ), CurrentDateTime )
VAR Hours =
DATEDIFF ( PreviousDateTimes, CurrentDateTime, HOUR )
VAR Days =
DATEDIFF ( PreviousDateTime, CurrentDateTime, DAY )
RETURN
IF ( Hours > 24, Days )

@tamerj1 - I attempted the above but they aren't giving correct minutes or days...Not sure

@rogerthat 
Are ayou creating a calculated column or a measure? If a measure, then please advise what do you have in the filter context.

Calculated column.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors