Forum Discussion
Cumulative Sales by Rank
You can create a calculated column in your sales table to calculate the cumulative sales for the subsequent 3 ranks.
DAX
Cumulative Sales =
VAR CurrentRank = Sales[Rank]
VAR CurrentCategory = Sales[Category]
RETURN
CALCULATE(
SUM(Sales[Sales]),
FILTER(
Sales,
Sales[Category] = CurrentCategory &&
Sales[Rank] >= CurrentRank &&
Sales[Rank] < CurrentRank + 3
)
)
Ensure that your filters for category and sales agent are applied to the visualizations where you use the cumulative sales column. Power BI will automatically respect these filters when calculating the cumulative sales.
Add a table visualization to your Power BI report and include the Rank, Category, Sales Agent, Sales, and the new Cumulative Sales column.
bhanu_gautam The context of the visual should be regarded. Meaning when I only have the rank column it should calculate the overall sum of sales for the last 3 ranks regardless of category and sales agent:
Any further ideas?