How to Calculate Cumulative Sum in Power BI

In this blog, I’ll describe how to calculate a cumulative sum by Product ID in Power BI.Here are step-by-step instructions for calculating a cumulative sum in Power BI using a measure.

Point-1. Import the Sales table from the Data Source

A screenshot of a computer

Description automatically generated

Point-2. Create a Measure-

In the “Fields” pane, right-click on your table (e.g., “Sales”) and select “New Measure.”

Enter the DAX Formula:

Give your new measure a name (e.g., “Product Cumulative Sales”).

Use the following DAX formula to calculate the cumulative sum:

Product Cumulative Sales = 

Var A= [Sales_] – Sum of sales

return

SUMX(

    FILTER(

        SUMMARIZE(ALL(Sales), Sales[Product ID],

        “revenue”, [Sales_]),

        [revenue]<=A),

        [revenue]

)

After entering the formula, press Enter to create the measure.

Point-3 Use in Visuals:

Now you can use the “Product Cumulative Sales” measure in your visuals, such as tables, to see the cumulative sum of sales for each Product ID.

Below is the screenshot

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.