Forum Discussion
Anonymous
7 years agoNot applicable
Previous Row Value in Calculated Column, not Measure
Hi, I'm simply trying to reference a previous row using a calculated column rather than a measure. I've seen a lot of solutions using measures, but not many using columns (and the column solutio...
- 7 years ago
Anonymous
Perfect, thank you for the sample file. We just need to incorporate the WELL_NAME into our calculation.
Calculated Column = VAR CurrentRow = 'ANADARKO_MV'[DAY_DATE] VAR CurrentWell = ANADARKO_MV[WELL_NAME] VAR PreviousDate = CALCULATE ( MAX ( 'ANADARKO_MV'[DAY_DATE] ), FILTER ( ALL ( 'ANADARKO_MV' ), 'ANADARKO_MV'[DAY_DATE] < CurrentRow && ANADARKO_MV[WELL_NAME] = CurrentWell) ) RETURN CALCULATE ( SELECTEDVALUE( 'ANADARKO_MV'[OIL_AP_DISP_CAT] ), FILTER ( ALL ( 'ANADARKO_MV' ), 'ANADARKO_MV'[DAY_DATE] = PreviousDate && ANADARKO_MV[WELL_NAME] = CurrentWell) )
jdbuchanan71
7 years agoSuper User
Anonymous
Perfect, thank you for the sample file. We just need to incorporate the WELL_NAME into our calculation.
Calculated Column =
VAR CurrentRow = 'ANADARKO_MV'[DAY_DATE]
VAR CurrentWell = ANADARKO_MV[WELL_NAME]
VAR PreviousDate =
CALCULATE (
MAX ( 'ANADARKO_MV'[DAY_DATE] ),
FILTER ( ALL ( 'ANADARKO_MV' ), 'ANADARKO_MV'[DAY_DATE] < CurrentRow && ANADARKO_MV[WELL_NAME] = CurrentWell)
)
RETURN
CALCULATE (
SELECTEDVALUE( 'ANADARKO_MV'[OIL_AP_DISP_CAT] ),
FILTER ( ALL ( 'ANADARKO_MV' ), 'ANADARKO_MV'[DAY_DATE] = PreviousDate && ANADARKO_MV[WELL_NAME] = CurrentWell)
)
Anonymous
6 years agoNot applicable
jdbuchanan71 Thanks again for helping me to solve my earlier problem. I'm trying to sum the [OIL_AP_DISP_CAT] per well in a column and I think it's going to be a similiar function right?
Is it possible to sum the total [OIL_AP_DISP_CAT] per well (it would just duplicate in the column for every date per well). I don't need to refer to the previous date like before.
Thanks again, I really appreciate yoru support.
Justin