Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Last Non zero Value based on max date

Hi All   I am trying to get the last charged amount to an id which im running into the issue of getting zeros where the last entry is a zero.   My current formula only looks at the max value base...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous Please try below measure. 

    Measure = 
    VAR _maxdate = CALCULATE(MAX('Table'[StartDate]),FILTER(ALLEXCEPT('Table','Table'[UnitId]),'Table'[ChargeAmount]>0))
    RETURN CALCULATE(MAX('Table'[ChargeAmount]),'Table'[StartDate]=_maxdate)

    If it helps accept as solution.