Forum Discussion

ironryan77's avatar
ironryan77
Kudo Commander
9 years ago
Solved

How do I create a cumulative sum over multiple columns?

I have a table in Power BI desktop that I'm trying to create a cumulative sum on. This is the SQL to create this table: create table #sample ( DOS_Month varchar(6) ,CRD_Month ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    ironryan77


    After importing the SQL table to Power BI Desktop, add an index column to the table in Query Editor.

     

    Then create the Cumulative measure using the DAX below.

    Cumulative = CALCULATE(SUM('sample'[Last_Mo_Collections]),FILTER(ALL('sample'),'sample'[Index]<=MAX('sample'[Index])))



    Regards,