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
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
Author By
Kamal Sharma
Kamal brings over 20 years of experience in data analytics and business intelligence. He has led the design and implementation of analytics solutions across operations, financial reporting, and performance improvement initiatives. With a background in business statistics and Six Sigma, his work focuses on applying data in a structured and practical way to solve real business challenges.