Forum Discussion

Chollid1's avatar
Chollid1
Frequent Visitor
9 years ago
Solved

Problem with Cumulative Total column

Stuck trying to figure out how to insert a calculated column... below is my code but it's only returning the values that already exist in the column May16    Column = CALCULATE(SUM(Sheet1[May16]),F...
  • CahabaData's avatar
    9 years ago

    Running = SUMX(
                                 FILTER( Sheet1,
                                                Sheet1[Day Of Month]<=EARLIER(Sheet1[Day Of Month])
                                            ),
                                 Sheet1[Column With Amount])

     

     

    ....didn't know the name of the column with the amount -- - so made that up....

     

    if this doesn't work please copy/type in a brief sample of the table itself to be viewed....

  • AlexChen's avatar
    9 years ago

    Hi,

     

    You can create a calculated column to do it. See my screenshots below.

     

    Running = SUMX(FILTER( Sheet1, Sheet1[Day Of Month]<=EARLIER(Sheet1[Day Of Month])), Sheet1[Column With Amount])

      

     

    Or you also can use a measure to achieve it.

     

    Measure = CALCULATE(sum(Sheet1[Column With Amount]), FILTER(Sheet1, Sheet1[Day Of Month] <= MAX(Sheet1[Day Of Month])))

     

     

    The difference between measure and calculated column is that a calculated column is just like any other column in a table and you can use it in rows, columns, filters, or values of a pivot table or any other report. While measure is an aggregated values from many rows in a table. The value of a calculated column is computed during data refresh and uses the current row as a context; A measure operates on aggregations of data defined by the current context.

     

    For more details about calculated column and measure, you can see here.

     

    BTW, for resolving “Sheet1” name issue, you may already have existing object named “Sheet1”. You  should change it to another name.

     

    Best Regards

    Alex