Forum Discussion

crobinson661's avatar
crobinson661
Frequent Visitor
2 years ago
Solved

Time Projection Modeling

I have a table that tracks how many days each step in a process takes, which varies based on an items value. I need to return the projected date of completion of only the remaining steps based on the current process step and value of the item selected. 

 

Here is the structure: 

table.Time is the table that tracks the time each process [Step] takes, which varies by cost, which is a range (2 fields [Cost Min]/[Cost Max]) 

Time
UNCost MinCost Max   Step                 Days
1010Step 11
2010Step 23
3010Step 35
4010Step 42
51120Step 11
61120Step 210
71120Step 35
81120Step 42
92130Step 11
102130Step 210
112130Step 35
122130Step 420

 

table.Item is the selection table where the [Cost] of an [Item] and the current [Step] the [Item] is in is identified when the item is selected

Item
Item      Cost       Step        
A10Step 1
B15Step 2
C27Step 4

 

Here are some examples of the output I would be seeking when each of the items above are selected: 

Return When Item A Selected
Remaining StepsProjected DateProjected Date Explained
Step 16/8/2024Based on Item.[Cost] and [Step] = TODAY() + UN1.[Days]
Step 26/11/2024Based on Item.[Cost] and [Step] = TODAY() + (UN1.[Days]+UN2.[Days])
Step 36/16/2024Based on Item.[Cost] and [Step] = TODAY() + (UN1.[Days]+UN2.[Days]+UN3.[Days])
Step 46/18/2024Based on Item.[Cost] and [Step] = TODAY() + (UN1.[Days]+UN2.[Days]+UN3.[Days]+UN4.[Days])
   
Return When Item B Selected
Remaining StepsProjected DateProjected Date Explained
Step 26/17/2024Based on Item.[Cost] and [Step] = TODAY() + (UN6.[Days])
Step 36/23/2024Based on Item.[Cost] and [Step] = TODAY() + (UN6.[Days]+UN7.[Days])
Step 46/25/2024Based on Item.[Cost] and [Step] = TODAY() + (UN6.[Days]+UN7.[Days]+UN8.[Days])
   
   
Return When Item C Selected
Remaining StepsProjected DateProjected Date Explained
Step 46/27/2024Based on Item.[Cost] and [Step] = TODAY() + (UN12.[Days])

 

I am unsure how to get the item.[Cost] and item.[Step] of the selected item.[Item] to match to the correct time.[Cost Min]/time.[Cost Max] range AND time.[Step] and return ONLY the current and future steps (see item B & C results above) AND project the dates by adding the time.[Days] from multiple steps. 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi crobinson661 ,

     

    Firstly, I think we need to create an unrelated DimStep table.

     

    DimStep = VALUES('Time'[Step])

     

    I suggest you to try code as below to create a measure.

     

    Projected Date = 
    VAR _ITEM = MAX('Item'[Item])
    VAR _Cost = SUM('Item'[Cost])
    VAR _STEP = MAX(DimStep[Step])
    VAR _STARTSTEP = MAX('Item'[Step])
    VAR _UNDAYS = CALCULATE(SUM('Time'[Days]),FILTER(ALLSELECTED('Time'),'Time'[Cost Min]<=_Cost && 'Time'[Cost Max]>=_Cost && 'Time'[Step]>=_STARTSTEP &&'Time'[Step] <= _STEP))
    VAR _TODAY = TODAY() /*This should be TODAY(), here we use 2024.06/07 to have a test.*/
    RETURN
    IF(_ITEM<>BLANK()&&_STEP>=_STARTSTEP,_TODAY+_UNDAYS)

     

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • what is your definition of "days"?  How about weekends and holidays? Does your source data have actual starting dates?

    • crobinson661's avatar
      crobinson661
      Frequent Visitor

      I was going to use NETWORKINGDAYS to exclude weekends and in the output examples table above in the [Projected Date Explained] column I demonstrate that the number of NETWORKINGDAYS for each remaining step would be calculated off TODAY(). 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi crobinson661 ,

         

        Firstly, I think we need to create an unrelated DimStep table.

         

        DimStep = VALUES('Time'[Step])

         

        I suggest you to try code as below to create a measure.

         

        Projected Date = 
        VAR _ITEM = MAX('Item'[Item])
        VAR _Cost = SUM('Item'[Cost])
        VAR _STEP = MAX(DimStep[Step])
        VAR _STARTSTEP = MAX('Item'[Step])
        VAR _UNDAYS = CALCULATE(SUM('Time'[Days]),FILTER(ALLSELECTED('Time'),'Time'[Cost Min]<=_Cost && 'Time'[Cost Max]>=_Cost && 'Time'[Step]>=_STARTSTEP &&'Time'[Step] <= _STEP))
        VAR _TODAY = TODAY() /*This should be TODAY(), here we use 2024.06/07 to have a test.*/
        RETURN
        IF(_ITEM<>BLANK()&&_STEP>=_STARTSTEP,_TODAY+_UNDAYS)

         

        Result is as below.

         

        Best Regards,
        Rico Zhou

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.