Forum Discussion

Tommyvhod's avatar
Tommyvhod
Icon for Helper II rankHelper II
6 years ago
Solved

Measure to filter days between operations

Hi guys   I am quite new to power BI and I am stuck with a report I would like to make. I have a list of IDs from production. We have in production 50 operations each with different number (e.g-20...
  • Nathaniel_C's avatar
    6 years ago

    Hi Tommyvhod , 

    Try these two measures to get the result in the picture. My table name is Fin.
    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

     

    Date diff = 
    VAR _Time =
         ( Fin[Finish date] ) //captures current date
    
    
    Var _maxLastTime = CALCULATE(MAX(Fin[Finish date]),FILTER(ALLEXCEPT(Fin,Fin[ID ]),Fin[Finish date]< _Time))
    
    var _datedif =DATEDIFF(_maxLastTime,Fin[Finish date],day)
    
    return
    if(_datedif>0,_datedif,0)
    
    ==================
    
    Date Dif per ID = CALCULATE(DATEDIFF(MIN(Fin[Finish date]),MAX(Fin[Finish date]),DAY),Filter(ALLEXCEPT(fin,Fin[ID ]),Fin[ID ])