Forum Discussion
Using slicer to change dates for calculating difference column
- Anonymous7 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
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 - MinTempThanks so much! Works perfectly.
I had been struggling for hours, and didn't think that a measure could dynamically hold values like this. Big props to you Chris.
For the current data set there is only one temperature data point for each depth for a given day. In future the frequency of the data will increase, from once/day -> once/15mins. From what I understand of this code, this approach will still work given the higher resolution, correct?