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])
camargos88
6 years agoCommunity Champion
Hi cmilligan262 ,
Try this code to create a calculated column:
Pior_Cost_Center =
VAR _date = 'Table (2)'[Date]
VAR _maxDate = CALCULATE(MAX('Table (2)'[Date]); FILTER(ALLEXCEPT('Table (2)';'Table (2)'[EMPID]); 'Table (2)'[Date] < _date))
RETURN CALCULATE(DISTINCT('Table (2)'[Cost Center Name]); FILTER(ALLEXCEPT('Table (2)';'Table (2)'[EMPID]); 'Table (2)'[Date] = _maxDate))
Ricardo