Forum Discussion

ssharm43's avatar
ssharm43
Icon for Helper I rankHelper I
6 years ago
Solved

calculate Dates based on conditions

Hello everyone !!

Please help me on this calculation, I am stuck on this from last 2 weeks.

 

I am trying to populate Final Dates column based on Final Dates Notes. Below is the data and description of the columns.

Final Dates column is based on Minimum dates taken from Actual Stage 1 completion date and Lifecycle Stage Completion Date for BU. 

 

logic is :

1. for Stage 1, populate Min(Actual Stage 1 Date) and for remaining Stage, populate Min(Lifecycle Stage Completion Date).

 

For Example :

Final Dates for Lifecycle Stage 1 date is Min(Actual Stage 1 Date) and for final dates Stage 2 is Min(Lifecycle Stage Completion Date) of Stage 1. 

 

 

Use CaseLifecycle StageLifecycle Stage Completion DateActual Stage 1 DateFinal DatesFinal Dates Notes
SWIMStage 19/1/20188/1/20188/1/2018Date from Actual Stage 1 Date
SWIMStage 2 8/1/20189/1/2018Date from SWIM Stage 1 Complete

 

 

BU = Business Unit

Use Case = group of conditions

Lifecyscle Stage = Stage for BU for each Use Case

Current Stage = Stage where currently BU is sitting in current date

Max Stage = Stage where BU reached across all the use case

Lifecycle Stage Completion Date = the date when a Lifecycle stage completed

Actual Stage 1 Date = Dates when first Stage got completed

Final Dates  = Minimum Dates from Lifecycle Stage Completion Date and Actual Stage 1 Date (this is what I have to calculate)

Final Dates Notes = Conditions for each row in Final Dates  on how it should populate

 

BUUse CaseLifecycle StageCurrent StageMax StageLifecycle Stage Completion DateActual Stage 1 DateFinal DatesFinal Dates Notes
BU1AssuranceStage 1Stage 1Stage 5 8/1/20188/1/2018Date from Actual Stage 1 Date
BU1AssuranceStage 2Stage 1Stage 5 8/1/20189/1/2018Stage not in progress. Date should match Stage 2 for rest of Use Cases
BU1AssuranceStage 3Stage 1Stage 5 8/1/20187/20/2019Stage not in progress. Date should match Stage 3 for rest of Use Cases
BU1AssuranceStage 4Stage 1Stage 5 8/1/20187/22/2019Stage not in progress. Date should match Use for rest of Use Cases
BU1AssuranceStage 5Stage 1Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Engage for rest of Use Cases
BU1AssuranceStage 6Stage 1Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Adopt for rest of Use Cases
BU1AssuranceStage 7Stage 1Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Optimize for rest of Use Cases
BU1AssuranceStage 8Stage 1Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Advocate for rest of Use Cases
BU1SWIMStage 1Stage 2Stage 59/1/20188/1/20188/1/2018Date from Actual Stage 1 Date
BU1SWIMStage 2Stage 2Stage 5 8/1/20189/1/2018Date from SWIM Stage 1 Complete
BU1SWIMStage 3Stage 2Stage 5 8/1/20187/20/2019Stage not in progress. Date should match Stage 3 for rest of Use Cases
BU1SWIMStage 4Stage 2Stage 5 8/1/20187/22/2019Stage not in progress. Date should match Use for rest of Use Cases
BU1SWIMStage 5Stage 2Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Engage for rest of Use Cases
BU1SWIMStage 6Stage 2Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Adopt for rest of Use Cases
BU1SWIMStage 7Stage 2Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Optimize for rest of Use Cases
BU1SWIMStage 8Stage 2Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Advocate for rest of Use Cases
BU1NDOStage 1Stage 5Stage 510/1/20188/1/20188/1/2018Date from Actual Stage 1 Date
BU1NDOStage 2Stage 5Stage 58/30/20198/1/20189/1/2018Date from SWIM Stage 1 Complete
BU1NDOStage 3Stage 5Stage 59/30/20198/1/20187/20/2019Date from SPA Stage 2 Complete
BU1NDOStage 4Stage 5Stage 53/5/20208/1/20187/22/2019Date from SPA Stage 3 Complete
BU1NDOStage 5Stage 5Stage 5 8/1/20183/5/2020Date from NDO Use Complete
BU1NDOStage 6Stage 5Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Adopt for rest of Use Cases
BU1NDOStage 7Stage 5Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Optimize for rest of Use Cases
BU1NDOStage 8Stage 5Stage 5 8/1/20183/5/2020Stage not in progress. Date should match Advocate for rest of Use Cases

 

8 Replies

  • ssharm43 , Try a formula like this as a new columns

    new column =
    var stg1= Minx(filter(Table[BU] = earlier([BU]) && [Current Stage]= earlier([Current Stage])),[Actual Stage 1 Date])
    var comp1= Minx(filter(Table[BU] = earlier([BU]) && [Current Stage]= earlier([Current Stage]) && not(isblank([Lifecycle Stage Completion Date])) ),[Lifecycle Stage Completion Date])
    return
    if([Current Stage] ="Stage1", stg1, coalesce(comp1,stg1))

     

    You may have to add or remove condition

    • ssharm43's avatar
      ssharm43
      Icon for Helper I rankHelper I

      Thank you amitchandak for trying, but this is not giving the output I am looking for. If you see in the data Final Date is the column I am looking for as output. I have to build a line chart using this column by join with Date dim.