Forum Discussion
Cumulative Total using measures
I have a dataset that has multiple timestamps for assets. I'm needing to retain the timestamps because I'll have a slider that allows you to adjust all of the visuals based on the timestamp. However, many of the measures I'm needing to calculate need to be done at the asset level. Here's an example of what my data looks like:
The yellow fields are present in the data and I have meaures to calculate the 3 orange columns. Here is how I'm calculating those.
total_benefit = SUM(table[benefit])
total_cost= SUM(table[cost])
2 Replies
- AnonymousNot applicable
I'm able to get a working cumulative cost with this measure:
cum_cost = SUMX(TOPN([benefit_rank], CALCULATETABLE(VALUES(table[asset]), ALLSELECTED(table[asset])),[benefit_rank], ASC), [cost_by_asset]).Then I've added another measure that calculates whether the cumulative cost is greater or equal to the budget parameter (slider).ind_cost_within_budget = IF([cum_cost] <= [Budget Value], 1, 0)Now I need to calculate the total benefit for those assets that are within the budget.This is what I have so far, but it just returns the total benefit, I need it to filter out the assets that aren't within the specified budget.benefit_within_budget = CALCULATE(SUM(table[benefit]), FILTER(table, [ind_cost_within_budget]=1)).Maybe I need to take a different approach here? Any thoughts?- AnonymousNot applicable
Hi Anonymous
You want to display the cumulative cost is greater or equal to the budget, you sholuld change the measure:
ind_cost_within_budget = IF([cum_cost] >= [Budget Value], 1, 0)and can you provide some sample data and the expected output you want?
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.