Forum Discussion
NasiraliKarwar
2 years agoFrequent Visitor
Fetching previous month value in calculation.
Hello, I am trying to fetch a value from a previous month in my further month's calculations: First logic: test overall due = CALCULATE(COUNT('Power BI'[Due Cases]), ALL('Power BI')) Sec...
Daniel29195
2 years agoCommunity Champion
output : ( COLUMN : measure )
use this measure :
measure =
var first_value =
CALCULATE(
[test_measure],
INDEX(
1,
ALLSELECTED(tbl[month],tbl[monthnb]),
ORDERBY(tbl[monthnb] , asc)
)
)
var v =
CALCULATE(
SUM([value]),
tbl[monthnb] <= MAX(tbl[monthnb]),
REMOVEFILTERS(tbl[month])
)
return first_value - v
NB: you need to create a monthnb and sort monthname column by monthnb .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
NasiraliKarwar
2 years agoFrequent Visitor
Thanks for response Daniel29195 ! This seems like it should work, but I am not sure what is going wrong. I am still getting wrong values in the calculations you proposed. Let me verify again and revert back with an explanation.