Forum Discussion
databot_kd
3 years agoHelper III
DAX Calculation - previous rows value bought into current row
Hi community,
How can i bring the previous rows value into the current row?
HC Latest Mon/Yr measure:
CALCULATE(COUNT('Headcount Details'[Position]),
MAXX(
KEEPFILTERS(VALUES('Headcount Details'[YearD])),
CALCULATE(MAX('Headcount Details'[Month]))
) = 'Headcount Details'[Month])
Used to get the count of position for the max month month in the year.
Used to get the count of position for the max month month in the year.
Thanks in advance
you forgot the bracket for ALLSELECTED('Headcount Details)
-----------------
Measure=
CALCULATE(
[HC Latest Mon/Yr],
OFFSET(-1,SUMMARIZE(ALLSELECTED('Headcount Details),'Headcount Details'[YearD]),ORDERBY('Headcount Details'[YearD]))
)
6 Replies
- AhmedxSuper User
pls try this
Measure= CALCULATE( [HC Latest Mon/Yr], OFFSET(-1,SUMMARIZE(ALLSELECTED('Headcount Details),'Headcount Details'[YearD],'Headcount Details'[MaxCurrentMonthYear]),ORDERBY('Headcount Details'[YearD])) )- databot_kdHelper III
Thanks Ahmedx for responding.
MaxCurrentMonthYear is also a measureMAXX(KEEPFILTERS(VALUES('Headcount Details'[YearD])),CALCULATE(MAX('Headcount Details'[Month])))it wont seem to work with SUMMARIZE- AhmedxSuper User
try this
Measure= CALCULATE( [HC Latest Mon/Yr], OFFSET(-1,SUMMARIZE(ALLSELECTED('Headcount Details),'Headcount Details'[YearD]),ORDERBY('Headcount Details'[YearD])) )