Forum Discussion
Anonymous
3 years agoNot applicable
Starting Windows function with 0?
Hi, I have a table visualization which takes sales by division and calculates the changes between each month by division. I'll paste the code I used below, but the problem is that the first data po...
- 3 years ago
Anonymous , Try like
Change =
[sales] -
coalesce(
CALCULATE(
[sales],
OFFSET(
-1,
SUMMARIZE(ALLSELECTED('Datatable'), Datatable[Division Name], Datatable[Eff Date]),
ORDERBY(Datatable[Eff Date]),
KEEP,
PARTITIONBY(Datatable[Division Name])
)
),[sales])
amitchandak
3 years agoSuper User
Anonymous , Try like
Change =
[sales] -
coalesce(
CALCULATE(
[sales],
OFFSET(
-1,
SUMMARIZE(ALLSELECTED('Datatable'), Datatable[Division Name], Datatable[Eff Date]),
ORDERBY(Datatable[Eff Date]),
KEEP,
PARTITIONBY(Datatable[Division Name])
)
),[sales])
Anonymous
3 years agoNot applicable
Thank you so much! So the solution was to wrap the whole calculate statement in a coalesce with [sales]. That makes a lot of sense, and I appreciate your help!