Forum Discussion
Anonymous
3 years agoNot applicable
Aggregate Subtraction Based on Rank
I'm trying to set up a column which incrementally subtracts demand from capacity based on rank (#1 rank will subtract demand from capacity, then #2 rank will subtract its demand from remaining capaci...
v-chenwuz-msft
3 years agoCommunity Support
Hi Anonymous ,
Is this you want?
Please use two table , one contains rank, project name, demand, another one group and capactiy like the following
Then create measure via this code:
Measure =
var _rank = MAX('Table'[rank])
var _demand = CALCULATE(SUM('Table'[demand]),FILTER(ALLSELECTED('Table'),[rank]<=_rank))
var _capacity = SUM(capacity[CAPACITY])
return
IF(HASONEVALUE('Table'[rank]),_capacity-_demand,_capacity)
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous3 years agoNot applicable
Thanks very much! This is super close to what I'm trying to accomplish. One item I failed to mention is that there can be multiple units of demand per project. These units are tied to the groups.
Below is an example of how demand differs by project & group. How would you update the measure to account for this?
Project Name group rank demand Project 1 Group1 1 20 Project 3 Group2 2 30 Project 19 Group3 3 0 Project 1 Group1 1 50 Project 3 Group2 2 100 Project 19 Group3 3 300