Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Measure Difference When Value = Value - 1

I have a measure, CRT, that is being displayed over an interval of every 30 minutes time. to make things easier I've attached an interval ID number that represents every 30 minutes of the day. 

 

I'm trying to measure the difference between the measure 30 minutes ago compared to the current time. I am coming up short. Currently I have the below attempt in DAX

CRT Difference =
VAR PrevCRT =
CALCULATE(IntraCRT[CRT],
FILTER(DAXIntervalID,
    DAXIntervalID[Value] = DAXIntervalID[Value] -1)
)
VAR CurrentCRT = IntraCRT[CRT]
RETURN
    PrevCRT - CurrentCRT
 
The outcome I receive for PrevCRT is blanks vs the CRT from 30 minutes prior. 

3 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Icon for Community Champion rankCommunity Champion
    CRT Difference =
    VAR PrevCRT =
    CALCULATE(IntraCRT[CRT],
    FILTER(ALL(DAXIntervalID[Value]),
        DAXIntervalID[Value] = DAXIntervalID[Value] -1)
    )
    VAR CurrentCRT = IntraCRT[CRT]
    RETURN
        PrevCRT - CurrentCRT
  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you so much for the quick reply. 

     

    Unfortunately that's giving me the same result.

     

     

    • wdx223_Daniel's avatar
      wdx223_Daniel
      Icon for Community Champion rankCommunity Champion
      CRT Difference =
      VAR PrevCRT =
      CALCULATE(IntraCRT[CRT],
      FILTER(ALL(DAXIntervalID[Value]),
          DAXIntervalID[Value] = MAX(DAXIntervalID[Value]) -1)
      )
      VAR CurrentCRT = IntraCRT[CRT]
      RETURN
          PrevCRT - CurrentCRT