Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Subtract Project Demand by Group Based on Ranking

Hello,

 

I'm trying to create a measure that will subtract the demand a certain project has on a group or multiple groups based on the projects ranking. Each of the groups has an X capacity to start, however; the demand for each project differs by # of hours and  which group the demand is for.  I'd like to visualize this with a matrix, where I have rank and project at the row level, and group name and total capacity at the column evel. The values within the matrix will be remaining capacity after subtracting the appropriate demand from each group based on its rank.

 

For source data, I currently have the demand and  capacity in two seperate tables.

 

Here is an example:

 

Rank 1 - Project A has 100 hours of demand from Group1, 0 hours of demand from Group2 and 200 hours of demand from Group3

Rank 2 - Project B has 0 hours of demand from Group1, 0 hours of demand from Group2 and 100 hours of demand from Group3

Rank 3 - Project C has 200 hours of demand froum Group 1, 400 hours of demand from Group2 and 300 hours of demand from Group3

 

  Group1Group2Group3
RankCapacity10001200400
1Project A9001200200
2Project B9001200100
3Project C700800-200

 

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous,

I'm not so sure how the start capacity is stored, can you please share some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

For your requirement, I'd like to suggest you write a measure formula with a variable to use current group to get the start capacity from the table. Then you can use the current group and rank as conditions to lookup and summary table records and calculate with the start value.

formula =
VAR startVolume = 'start capacity'
VAR currRank =
    MAX ( Table[Rank] )
VAR rollingCapacity =
    CALCULATE (
        SUM ( Table[Capacity] ),
        FILTER ( ALLSELECTED ( Table ), [Rank] <= currRank ),
        VALUES ( Table[Group] )
    )
RETURN
    startVolume - rollingCapacity

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

GroupMonthHours
Group 1            2022-01160
Group 12022-02160
Group 12022-03160
Group 12022-04160
Group 12022-05160
Group 12022-06160
Group 12022-07160
Group 12022-08160
Group 12022-09160
Group 12022-10160
Group 12022-11160
Group 12022-12160
Group 22022-01160
Group 22022-02160
Group 22022-03160
Group 22022-04160
Group 22022-05160
Group 22022-06160
Group 22022-07160
Group 22022-08160
Group 22022-09160
Group 22022-10160
Group 22022-11160
Group 22022-12160
Group 3   2022-01160
Group 32022-02160
Group 32022-03160
Group 32022-04160
Group 32022-05160
Group 32022-06160
Group 32022-07160
Group 32022-08160
Group 32022-09160
Group 32022-10160
Group 32022-11160
Group 32022-12160
Group 42022-01480
Group 42022-02480
Group 42022-03480
Group 42022-04480
Group 42022-05480
Group 42022-06480
Group 42022-07480
Group 42022-08480
Group 42022-09480
Group 42022-10480
Group 42022-11  480
Group 42022-12 480

 Here is the source data for capacity/group/month.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.