Forum Discussion
Cumulative Sum with condicion
- 2 years ago
output :
use the meaure below :
this measure assume that you are reading the date from the same table ,
if not, then simply change allselected(tbl_name[date]) to allselected(dimdate[date]) and orderby(dimdate[date], asc)
Measure 10 = var prev_value = CALCULATE( SUM('tbl_name'[Value]), OFFSET( -1, ALLSELECTED('tbl_name'[date]), ORDERBY('tbl_name'[date] , asc) ) ) return MAX(0,SUM('tbl_name'[Value]) - 1 + prev_value)let me know if it works for you .
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! 🤠
output :
use the meaure below :
this measure assume that you are reading the date from the same table ,
if not, then simply change allselected(tbl_name[date]) to allselected(dimdate[date]) and orderby(dimdate[date], asc)
Measure 10 =
var prev_value =
CALCULATE(
SUM('tbl_name'[Value]),
OFFSET(
-1,
ALLSELECTED('tbl_name'[date]),
ORDERBY('tbl_name'[date] , asc)
)
)
return
MAX(0,SUM('tbl_name'[Value]) - 1 + prev_value)
let me know if it works for you .
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! 🤠
- David-Menacho2 years agoFrequent Visitor
thanks! it was what i needed