Join 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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi,
I have n number of tickets. Each ticket has a created and changed date. Example:
| Ticket | Create | Change | Desired Result |
| 11 | 02.01.2018 | 02.02.2018 | 1 |
| 11 | 02.01.2018 | 02.04.2018 | 2 |
| 11 | 02.01.2018 | 02.08.2018 | 4 |
I want to filter based on [Ticket], and diff between the [Change] dates and input that into a [Desired Result] column. One catch is, the 1st value for each ticket uses [Create] - [Change] instead.
Where I'm at, I used rankx to create a calculated column to rank the tickets. I'm thinking of creating another calculated column to then rank based on [Change]. And then somehow use this new column as a reference for the desired result. But this approach seems overly complex.
Alternatively, maybe I could diff between [Create] and [Change] for each row, and then do the subtraction with current row and previous row, filtered by [Ticket]? But I'm also unable to figure out the proper DAX expression for that.
Solved! Go to Solution.
Try this Calculated Column
Desired Result =
VAR First_Date =
CALCULATE (
MIN ( TableName[Change] ),
ALLEXCEPT ( TableName, TableName[Ticket] )
)
VAR PreviousChange =
CALCULATE (
MAX ( TableName[Change] ),
FILTER (
ALLEXCEPT ( TableName, TableName[Ticket] ),
TableName[Change] < EARLIER ( TableName[Change] )
)
)
RETURN
IF (
TableName[Change] = First_Date,
DATEDIFF ( TableName[Create], TableName[Change], DAY ),
DATEDIFF ( PreviousChange, TableName[Change], DAY )
)
Try this Calculated Column
Desired Result =
VAR First_Date =
CALCULATE (
MIN ( TableName[Change] ),
ALLEXCEPT ( TableName, TableName[Ticket] )
)
VAR PreviousChange =
CALCULATE (
MAX ( TableName[Change] ),
FILTER (
ALLEXCEPT ( TableName, TableName[Ticket] ),
TableName[Change] < EARLIER ( TableName[Change] )
)
)
RETURN
IF (
TableName[Change] = First_Date,
DATEDIFF ( TableName[Create], TableName[Change], DAY ),
DATEDIFF ( PreviousChange, TableName[Change], DAY )
)
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 48 | |
| 35 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 93 | |
| 79 | |
| 37 | |
| 27 | |
| 25 |