Forum Discussion

Jay0610's avatar
Jay0610
Frequent Visitor
4 years ago
Solved

Cumulative Totals

Hi,   I'm struggling with the DAX for calculating  the monthly cumulative shown below. (resets on each month)     Ive tried using the following but no joy! Any help would be really appreci...
  • Ashish_Mathur's avatar
    4 years ago

    Hi,

    Assuming Date and Margin are columns already present in your source data table, perform the following steps:

    1. Create a Calendar Table
    2. Build a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of your Calendar Table
    3. To your Table/Matrix visual, drag Date from the Calendar Table
    4. Write these measures:

    Total = sum(Data[Margin])

    MTD Total = calculate([Total],datesmtd(calendar[date]))

    Hope this helps.

  • Jay0610's avatar
    Jay0610
    4 years ago

    Hi Ashish, I decided to group by date in power query as that was effectively what I was doing on the table visual in power BI. I was then able to use your method for cumulative totals on the daily target. Many thanks for your assistance with this, really appreciated