Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Grab value from another row to current row value

Guys- have a question here.

 

I am trying to grab an Actual FinishDate value from each project and then reflect it in a new column/measure. In this example, for project ID 1000, I like to get the actual FinishDate from Phase Name [milestone 1] and insert it into Phase Name [Phase 1]. 

Then I will do that for project ID 2000 etc. 

 

I will use the same logic for Phase 2, milestone 2 etc for subsequent projects.

 

 

 

  • Hi,

    Please check the below picture.

    It is for creating a new column.

     

     

    Actual_Milestone CC =
    VAR currentproject = Data[Project ID]
    VAR currentphasenumber =
    RIGHT ( Data[Phase Name], 1 )
    VAR filter_only_milestone =
    FILTER (
    Data,
    Data[Project ID] = currentproject
    && CONTAINSSTRING ( Data[Phase Name], "M" )
    && RIGHT ( Data[Phase Name], 1 ) = currentphasenumber
    )
    VAR milestonedate =
    MAXX ( filter_only_milestone, Data[Actual Finishdate] )
    RETURN
    IF ( Data[Estimate Finishdate] = BLANK (), BLANK (), milestonedate )

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hey! Anonymous 

     

    The following Calculated Column works perfectly fine.

     

    NewCol =
    VAR rightval =
    RIGHT ( 'Table'[Phase Name], 1 )
    VAR maxval =
    CALCULATE (
    MAX ( 'Table'[Actual Date] ),
    FILTER (
    ALL ( 'Table' ),
    EARLIER ( 'Table'[ProjectID] ) = 'Table'[ProjectID]
    && RIGHT ( 'Table'[Phase Name], 1 ) = rightval
    && LEFT ( 'Table'[Phase Name], 1 ) = "M"
    )
    )
    RETURN
    IF ( 'Table'[Estimate Date] = BLANK (), BLANK (), maxval )
     
    Please accept it as a solution if it fulfills your requirement.

5 Replies

  • Hi,

    Please check the below picture.

    It is for creating a new column.

     

     

    Actual_Milestone CC =
    VAR currentproject = Data[Project ID]
    VAR currentphasenumber =
    RIGHT ( Data[Phase Name], 1 )
    VAR filter_only_milestone =
    FILTER (
    Data,
    Data[Project ID] = currentproject
    && CONTAINSSTRING ( Data[Phase Name], "M" )
    && RIGHT ( Data[Phase Name], 1 ) = currentphasenumber
    )
    VAR milestonedate =
    MAXX ( filter_only_milestone, Data[Actual Finishdate] )
    RETURN
    IF ( Data[Estimate Finishdate] = BLANK (), BLANK (), milestonedate )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi JH,

       

      Thanks for your post. What if data is changed to the below?

       

      ProjectNamePhase NameForecastFinishDateActualFinishDateCalculated Value

      1000Project Initiation Phase23/01/20185/02/20185/02/2018
      1000M02XYZ00/00/00005/02/2018 
      1000Scope and Feasibility Phase28/05/201812/07/201812/07/2018
      1000M04AGD00/00/000012/07/2018 
      1000Design Phase14/06/201911/06/201928/05/2019
      1000M12ADS00/00/000028/05/2019 
      1000Delivery Phase20/05/202027/08/202030/04/2020
      1000M23AAA00/00/000030/04/2020 
      1000Hand Over Phase10/12/20194/02/20214/02/2021
      1000M24BBB00/00/00004/02/2021 
      1000Project Close Phase10/12/201900/00/00004/02/2021
      1000M25CCC00/00/00004/02/2021 
      2000Delivery Phase29/01/201900/00/000000/00/0000
      2000M23AAA00/00/000000/00/0000 
      2000Hand Over Phase1/03/201900/00/000000/00/0000
      2000M24BBB00/00/000000/00/0000 
      2000Project Close Phase29/02/202000/00/000000/00/0000
      2000M25CCC00/00/000000/00/0000 
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hey! Anonymous 

     

    The following Calculated Column works perfectly fine.

     

    NewCol =
    VAR rightval =
    RIGHT ( 'Table'[Phase Name], 1 )
    VAR maxval =
    CALCULATE (
    MAX ( 'Table'[Actual Date] ),
    FILTER (
    ALL ( 'Table' ),
    EARLIER ( 'Table'[ProjectID] ) = 'Table'[ProjectID]
    && RIGHT ( 'Table'[Phase Name], 1 ) = rightval
    && LEFT ( 'Table'[Phase Name], 1 ) = "M"
    )
    )
    RETURN
    IF ( 'Table'[Estimate Date] = BLANK (), BLANK (), maxval )
     
    Please accept it as a solution if it fulfills your requirement.
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Shwet

       

      what if data is changed to the following:

       

      ProjectNamePhase NameForecastFinishDateActualFinishDateCalculated Value

      1000Project Initiation Phase23/01/20185/02/20185/02/2018
      1000M02XYZ00/00/00005/02/2018 
      1000Scope and Feasibility Phase28/05/201812/07/201812/07/2018
      1000M04AGD00/00/000012/07/2018 
      1000Design Phase14/06/201911/06/201928/05/2019
      1000M12ADS00/00/000028/05/2019 
      1000Delivery Phase20/05/202027/08/202030/04/2020
      1000M23AAA00/00/000030/04/2020 
      1000Hand Over Phase10/12/20194/02/20214/02/2021
      1000M24BBB00/00/00004/02/2021 
      1000Project Close Phase10/12/201900/00/00004/02/2021
      1000M25CCC00/00/00004/02/2021 
      2000Delivery Phase29/01/201900/00/000000/00/0000
      2000M23AAA00/00/000000/00/0000 
      2000Hand Over Phase1/03/201900/00/000000/00/0000
      2000M24BBB00/00/000000/00/0000 
      2000Project Close Phase29/02/202000/00/000000/00/0000
      2000M25CCC00/00/000000/00/0000