Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Using slicer to change dates for calculating difference column

Hi all,   I'm at a loss here and would love some help.       This is what my data looks like. The depth column increases by 0.5, which is why I created the groups column. Another example ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    How many data points are there for each depth and time?  Assuming only row for each combination, the following code shoud work.  Note that this is a measure, not a calculated column, so it will respond to a slicer.

     

    Delta =
    VAR MaxDate =
        MAX ( Table[Date] )
    VAR MinDate =
        MIN ( Table[Date] )
    VAR MinTemp =
        CALCULATE (
            MIN ( Table[Temperature] ),
            Table[Date] = MinDate
        )
    VAR MaxTemp =
        CALCULATE (
            MAX ( Table[Temperature] ),
            Table[Date] = MaxDate
        )
    RETURN
        MaxTemp - MinTemp