Forum Discussion
cmilligan262
6 years agoHelper II
Prior month Value Calculated Column
I need to get movement in our roster and need to pull in the prior months cost center name in a calculcated column This is what my data looks like Date EMPID ...
- 6 years ago
Perhaps:
Column = VAR __PreviousDate = MAXX(FILTER('Table',[Date]<EARLIER([Date])&&[EMPID]=EARLIER([EMPID])),[Date]) RETURN MAXX(FILTER('Table',[EMPID]=EARLIER([EMPID]) && [Date]=__PreviousDate),[Cost Center Name])
v-easonf-msft
6 years agoCommunity Support
Hi , cmilligan262
Here is a demo.
Try to change your measure as below:
The prior cost center column =
VAR d = [Date]
RETURN
CALCULATE (
MAX ( 'Table'[Cost Center Name] ),
FILTER (
'Table',
'Table'[EMPID] = EARLIER ( 'Table'[EMPID] )
&& 'Table'[Date]
>= DATE ( YEAR ( d ), MONTH ( d ) - 1, 1 )
&& 'Table'[Date]
<= DATE ( YEAR ( d ), MONTH ( d ), 1 ) - 1
)
)
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.