Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
ID | DATTIME | TIME | STATUS | CONSECUTIVE MINUTES | MISSING DAYS STATUS |
XYZ | 3/13/2023 | 2:00PM | COMPLETED | ||
XYZ | 3/13/2023 | 3:30PM | COMPLETED | 90 | |
BYZ | 3/14/2023 | 9:00AM | INCOMPLETE | ||
BYZ | 3/14/2023 | 11:00AM | INCOMPLETE | 120 | |
XYZ | 3/15/2023 | 5:00PM | INCOMPLETE | 2 | |
BYZ | 3/17/2023 | 9:00AM | COMPLETED | 3 |
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |