Forum Discussion
Getting row values from another row based on associated texts
- 4 years ago
Hi Anonymous
Try this new code to add a column:
Calculated Value = VAR _A = SWITCH ( TRUE (), [ObjectName] = "Project Initiation Phase", "M02 - Approve Fee Proposal", [ObjectName] = "Scope and Feasibility", "M04 - Approve Phase 1 Report", [ObjectName] = "Design Phase", "M12 - Approve Phase 2 Report", [ObjectName] = "Delivery Phase", "M23 - Issue Certificate of Completion", [ObjectName] = "Hand Over/Take Over Phase", "M24 - Recommend Hand Over Acceptance", [ObjectName] = "Project Close Phase", "M25 - Reduce PO Values To Zero", [ObjectName] = "Scope and Feasibility Phase", "Scope and Feasibility Phase", BLANK () ) VAR _B = IF ( ISBLANK ( _A ), BLANK (), CALCULATE ( MAX ( 'Table'[ActualFinishDate] ), FILTER ( ALL ( 'Table' ), [ObjectName] = _A && [ProjectName] = EARLIER ( 'Table'[ProjectName] ) ) ) ) RETURN IF ( ISBLANK ( _B ), CALCULATE ( MAX ( 'Table'[FinishDate] ), FILTER ( ALL ( 'Table' ), [ObjectName] = _A && [ProjectName] = EARLIER ( 'Table'[ProjectName] ) ) ), _B )Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
How did you find that 11/10/2021 instead of 00/00/0000 for project close project 2000? there is no date like that in your table?
can you add more details?
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Hi Vahid,
See this updated dataset-realised that it wasn't updated properly previously. I need to use the 5th column data (See the orange in M25 in particular) for the calculated field.
| ProjectName | ObjectName | ForecastFinishDate | ActualFinishDate | FinishDate | Calculated |
| 1000 | Delivery Phase | 20/05/2020 | 27/08/2020 | 30.04.2020 | 30/04/2020 |
| 1000 | Design Phase | 14/06/2019 | 11/06/2019 | 11.06.2019 | 28/05/2019 |
| 1000 | Hand Over/Take Over Phase | 10/12/2019 | 4/02/2021 | 24.02.2021 | 4/02/2021 |
| 1000 | M02 - Approve Fee Proposal | 00/00/0000 | 5/02/2018 | 05.02.2018 | |
| 1000 | M04 - Approve Phase 1 Report | 00/00/0000 | 12/07/2018 | 12.07.2018 | |
| 1000 | M12 - Approve Phase 2 Report | 00/00/0000 | 28/05/2019 | 11.06.2019 | |
| 1000 | M23 - Issue Certificate of Completion | 00/00/0000 | 30/04/2020 | 30.04.2020 | |
| 1000 | M24 - Recommend Hand Over Acceptance | 00/00/0000 | 4/02/2021 | 24.02.2021 | |
| 1000 | M25 - Reduce PO Values To Zero | 00/00/0000 | 4/02/2021 | 11.03.2021 | |
| 1000 | Project Close Phase | 10/12/2019 | 00/00/0000 | 30.04.2021 | 4/02/2021 |
| 1000 | Project Initiation Phase | 23/01/2018 | 5/02/2018 | 05.02.2018 | 5/02/2018 |
| 1000 | Scope and Feasibility Phase | 28/05/2018 | 12/07/2018 | 12.07.2018 | 12/07/2018 |
| 2000 | Delivery Phase | 25/11/2019 | 20/11/2019 | 20.11.2019 | 20/11/2019 |
| 2000 | Design Phase | 10/12/2016 | 6/04/2018 | 06.04.2018 | 6/04/2018 |
| 2000 | Hand Over/Take Over Phase | 30/09/2019 | 23/07/2020 | 21.02.2020 | 4/08/2020 |
| 2000 | M02 - Approve Fee Proposal | 00/00/0000 | 1/06/2015 | 01.06.2015 | |
| 2000 | M04 - Approve Phase 1 Report | 00/00/0000 | 22/10/2016 | 24.10.2016 | |
| 2000 | M12 - Approve Phase 2 Report | 00/00/0000 | 6/04/2018 | 06.04.2018 | |
| 2000 | M23 - Issue Certificate of Completion | 00/00/0000 | 20/11/2019 | 20.11.2019 | |
| 2000 | M24 - Recommend Hand Over Acceptance | 00/00/0000 | 4/08/2020 | 21.02.2020 | |
| 2000 | M25 - Reduce PO Values To Zero | 00/00/0000 | 00/00/0000 | 11.10.2021 | |
| 2000 | Project Close Phase | 22/10/2020 | 00/00/0000 | 19.02.2021 | 11/10/2021 |
| 2000 | Project Initiation Phase | 1/06/2015 | 1/06/2015 | 01.06.2015 | 1/06/2015 |
| 2000 | Scope and Feasibility Phase | 22/10/2016 | 22/10/2016 | 24.10.2016 | 22/10/2016 |
| 3000 | … | … | … | … | |
| 3000 | … | … | … | … |