Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi everyone,
I am currently having a dataframe in the following format:
I would like to analyse the status transitions that occur and the time these transitions take.
For this I would like to obtain a dataset in the following format:
However, I am struggling to find a way to do this in DAX.
Does anyone have a suggestion on how this can be obtained?
Thanks in advance.
Solved! Go to Solution.
You can use this calculated table
From the Modelling Tab >> NEw Table
Calculated Table =
VAR temp =
ADDCOLUMNS (
Table1,
"Status New",
VAR nextrow =
TOPN (
1,
FILTER ( Table1, [ID] = EARLIER ( [ID] ) && [Day] > EARLIER ( [Day] ) ),
[Day], ASC
)
RETURN
MINX ( nextrow, [Status] ),
"Days Between",
VAR nextrow =
TOPN (
1,
FILTER ( Table1, [ID] = EARLIER ( [ID] ) && [Day] > EARLIER ( [Day] ) ),
[Day], ASC
)
RETURN
MINX ( nextrow, [Day] ) - [Day]
)
RETURN
SELECTCOLUMNS (
FILTER ( temp, NOT ( ISBLANK ( [Status New] ) ) ),
"ID", [ID],
"Status Old", [Status],
"Status New", [Status New],
"Days Between", [Days Between]
)
Please, can you explain what do you mean with "status transitions" ? I don't know why the second table is constructed using the first.
Thanks.
Each ID takes on different status values over time.
For ID 1, the status values are 0 > 1 > 3 > 5.
I am interested in the transitions, so going from 0 > 1, 1 > 3, etc.
The value I would like to know for each transition is the difference in days between the two status values.
So for ID 1 and transition 0 > 1, this is 11-0 = 11 days.
For ID 1 and transition 1 > 3, this is 21-11 = 10 days.
You can use this calculated table
From the Modelling Tab >> NEw Table
Calculated Table =
VAR temp =
ADDCOLUMNS (
Table1,
"Status New",
VAR nextrow =
TOPN (
1,
FILTER ( Table1, [ID] = EARLIER ( [ID] ) && [Day] > EARLIER ( [Day] ) ),
[Day], ASC
)
RETURN
MINX ( nextrow, [Status] ),
"Days Between",
VAR nextrow =
TOPN (
1,
FILTER ( Table1, [ID] = EARLIER ( [ID] ) && [Day] > EARLIER ( [Day] ) ),
[Day], ASC
)
RETURN
MINX ( nextrow, [Day] ) - [Day]
)
RETURN
SELECTCOLUMNS (
FILTER ( temp, NOT ( ISBLANK ( [Status New] ) ) ),
"ID", [ID],
"Status Old", [Status],
"Status New", [Status New],
"Days Between", [Days Between]
)
See the File attached as well
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |