Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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...
  • amitchandak's avatar
    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])