Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
I'm hoping someone can help with this challenge, which is outside my level of knowledge with power bi.
Goal:
I have a table that provides a daily snapshot of work item IDs. Each row specifies the "Work Item ID", the "Date", and the "Parent Work Item ID" (this is the parent ID of the work item listed in the first column). What I need to do is be able to identify the most recent date before a work item's parent ID changed. This is because I'm trying to measure the most recent date that a work item had it's parent ID changed to "142395". The challenge is that during the history of a work item, it may have changed parent ID to "142395" more than once, and I need the most recent date that it did this, not the earliest (which I'm currently only able to do).
Example:
I hope that makes sense in terms of what I'm trying to achieve. I'd imagine the solution involves starting at the most recent date for each work item, traversing down each day, comparing the parent work item ID to the previous date's parent work item ID, and then returning the date before it changes to something different. But I just don't know the DAX for this.
Many thanks for any help provided.
Solved! Go to Solution.
Hi @mjhpbicommunity ,
If you want a column, please try the formula below.
You will need to create an index column in Query Editor first.
Column =
CALCULATE (
MAX ( 'Table'[parent work item id] ),
FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) + 1 )
)
Column 2 =
CALCULATE (
MAX ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[work item id], 'Table'[parent work item id] ),
'Table'[parent work item id] <> 'Table'[Column]
)
)
Result would be shown as below.
Best Regards,
Jay
Hi @mjhpbicommunity ,
If you want a column, please try the formula below.
You will need to create an index column in Query Editor first.
Column =
CALCULATE (
MAX ( 'Table'[parent work item id] ),
FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) + 1 )
)
Column 2 =
CALCULATE (
MAX ( 'Table'[date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[work item id], 'Table'[parent work item id] ),
'Table'[parent work item id] <> 'Table'[Column]
)
)
Result would be shown as below.
Best Regards,
Jay
Try this measure:
Change Date =
VAR vMaxWorkItemDate =
MAX ( WorkItems[Date] )
VAR vParentWorkItem =
CALCULATE (
MAX ( WorkItems[Parent Work Item id] ),
WorkItems[Date] = vMaxWorkItemDate
)
VAR vMaxPreviousWorkItemDate =
CALCULATE (
MAX ( WorkItems[Date] ),
WorkItems[Parent Work Item id] <> vParentWorkItem
)
VAR vResult =
CALCULATE (
MIN ( WorkItems[Date] ),
WorkItems[Date] > vMaxPreviousWorkItemDate
)
RETURN
vResult
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |