Forum Discussion

samdep's avatar
samdep
Icon for Advocate II rankAdvocate II
4 years ago
Solved

Creating a Flag for Stable or Reduced Rating

Hi Community!   I have a table similar to the below:   Client Assessment Rating Flag 123 Initial 2 Stable or Reduced  456 Initial 1 Stable or Reduced  123 Final 1 Stable...
  • Greg_Deckler's avatar
    4 years ago

    samdep Seems like you need to be able to compare the current row with the previous row, that's the MTBF pattern. Although your use case is entirely different. You will need an index column or date column to define "previous".

    See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
    The basic pattern is:
    Column = 
      VAR __Current = [Value]
      VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

      VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
    RETURN
      __Current - __Previous