Forum Discussion
Cumulative Measure
- 1 year ago
Hi Ramenboi11 can you please check if this is as required
Cumulative Budget =VAR SelectedDate = MAX('Date'[Date])VAR InitialBudget =CALCULATE(MAX(BudgetData[OriginalBudget]),FILTER(ALL(BudgetData),NOT(ISBLANK(BudgetData[OriginalBudget]))))VAR TotalChange =CALCULATE(SUM(BudgetData[ChangeOrder]),FILTER(ALL('Date'),'Date'[Date] <= SelectedDate))RETURNInitialBudget + TotalChange - 1 year ago
Hi Ramenboi11
To calculate the cumulative budget in Power BI, you need to start by identifying the original budget amount, which typically appears only once (often at the start or in a separate row).
Then, create a DAX measure that adds this original budget to the cumulative sum of monthly change orders. This can be done by using a measure that retrieves the maximum original budget from non-blank and non-zero entries, and then another measure that sums the change orders up to the current month.To ensure proper ordering, especially if your month column is text (like "Jan", "Feb"), create a separate column that assigns a numerical value to each month and use it to sort the visual.
The final measure will calculate the cumulative budget by adding the initial budget to the sum of all change orders up to the selected month, allowing you to track how your budget evolves over time.
Total Org Budget =
CALCULATE(
SUM(BudgetData[OrgBudget]),
FILTER(BudgetData, NOT(ISBLANK(BudgetData[OrgBudget])) && BudgetData[OrgBudget] <> 0)
)
Create the Cumulative Measure
Cumulative Budget =
VAR OrgBudget =
CALCULATE(
SUM(BudgetData[OrgBudget]),
FILTER(BudgetData, NOT(ISBLANK(BudgetData[OrgBudget])) && BudgetData[OrgBudget] <> 0)
)
VAR CumulativeChange =
CALCULATE(
SUM(BudgetData[ChangeOrder]),
FILTER(
ALLSELECTED(BudgetData),
BudgetData[Month] <= MAX(BudgetData[Month])
)
)
RETURN
OrgBudget + CumulativeChange
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- Ramenboi111 year agoNew Member
I tried This solution however the column just shows how much each change order was for what I wanted to see was
Change. Cumulative Budget
jan 0. 2000
feb +500. 2500
mar. -750. 1750