Forum Discussion
Anonymous
4 years agoNot applicable
Getting row values from another row based on associated texts
Hi I am trying to get the calculated value based on these relationships: Project Initiation Phase - M02 Scope and Feasibility - M04 Design Phase - M12 Delivery Phase - M23 Handover/Takeov...
- 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/
Anonymous
4 years agoNot applicable
See this particular row in the dataset.
| 2000 | M25 - Reduce PO Values To Zero | 00/00/0000 | 00/00/0000 | 11.10.2021 |
VahidDM
Super User
4 years agoHi 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/
- Anonymous4 years agoNot applicable
Thanks Vahid-that was brilliant scripting that helped a lot! 🙂
- VahidDM4 years ago
Super User
No Worries 🙏