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

Rajeshwari Sharma
Rajeshwari is an experienced data professional with a track record of using data-driven insights to improve business performance. She has successfully managed multiple projects, utilising her expertise in data analysis and database administration. As a Microsoft-certified Data Analyst and Azure Database Administrator, she has cultivated a deep understanding of data management best practices and advanced analytics techniques. Her MBA in Business Analytics has equipped her with a solid foundation for integrating business strategy with data insights.