In this blog, I’ll describe how to calculate a cumulative sum by Product ID in Power B.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
SUMMARIZE(ALL(Sales), Sales[Product ID],
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