Forum Discussion
Calculated column with a value from a previous row
- Anonymous2 years ago
Hi,
Thanks for the solution bhanu_gautam offered and i want to offer some more information for user to refer to.
hello lawena , you can try the following calculated column.
Column = VAR _filterindex = MAXX ( FILTER ( 'ClosedFeaturesByObjective', [Work Item type] = "Objective" && [Index] <= EARLIER ( 'ClosedFeaturesByObjective'[Index] ) ), [Index] ) VAR _id = LOOKUPVALUE ( 'ClosedFeaturesByObjective'[ID], [Index], _filterindex ) RETURN IF ( [Work Item type] = "Feature", _id )Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lawena , You can try creating a new calculated column using below DAX
DAX
PreviousObjectiveID =
VAR CurrentIndex = ClosedFeaturesByObjective[Index]
VAR PreviousObjectiveID =
MAXX(
FILTER(
ClosedFeaturesByObjective,
ClosedFeaturesByObjective[Index] < CurrentIndex &&
ClosedFeaturesByObjective[Work Item type] = "Objective"
),
ClosedFeaturesByObjective[ID]
)
RETURN
IF(
ClosedFeaturesByObjective[Work Item type] = "Feature",
PreviousObjectiveID,
BLANK()
)
Thanks bhanu_gautam
I've tried a similar query using MAXX
The result gives the first objectiveID to all the Features, similar to this:
| Index | ID | Work Item type | PreviousObjectiveID |
|-------|-----|----------------|---------------------|
| 1 | 7 | Objective | |
| 2 | 5 | Feature | 7 |
| 3 | 4 | Feature | 7 |
| 4 | 2 | Objective | |
| 5 | 8 | Feature | 7 |
| 6 | 1 | Objective | |
- Anonymous2 years agoNot applicable
Hi,
Thanks for the solution bhanu_gautam offered and i want to offer some more information for user to refer to.
hello lawena , you can try the following calculated column.
Column = VAR _filterindex = MAXX ( FILTER ( 'ClosedFeaturesByObjective', [Work Item type] = "Objective" && [Index] <= EARLIER ( 'ClosedFeaturesByObjective'[Index] ) ), [Index] ) VAR _id = LOOKUPVALUE ( 'ClosedFeaturesByObjective'[ID], [Index], _filterindex ) RETURN IF ( [Work Item type] = "Feature", _id )Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- lawena2 years agoRegular Visitor
Brilliant - this works on my data, thank you Anonymous