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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Alicia_Anderson
Resolver I
Resolver I

Match value in one table to row in another table

I have a Dimension table called Teams with [Team] value.  This is the main slicer on my page.

I have a Capacity table with three fields [Yr\Sprint], [Capacity], [Team].  (1>many relationship to above.) 

I created a measure to capture the Running Total for Capacity.  When viewing a table, the data looks correct.   

 
Cap_RT = CALCULATE(SUM('Capacity'[Capacity]),
    FILTER(ALLSELECTED(Capacity), 'Capacity'[Yr\Sprint] <= MAX('Capacity'[Yr\Sprint]) )  )

The main table on the page displays 'Features Open'.   There is a 1>many relationship on Team to Teams[Team] here as well.

I have a measure that calculates the Running Total of RemPts.   The data in this table also looks right.  

 
RemPts_RT = CALCULATE(SUM('Features Open'[RemPts]),
    FILTER(ALLSELECTED('Features Open'),
        'Features Open'[Backlog Priority] <= MAX('Features Open'[Backlog Priority]) &&
        'Features Open'[Team] = MAX('Features Open'[Team])  )  )

I want a measure that uses  the running total from the left table (Features Open) and finds the row with the closest running total (that is not greater) to the table on the right (Capacity).  If the Run Total from Features Open table is <= Run Total from Capacity table, then append the last 2 digits of the Yr\Sprint column to "Fits in S".  If not found, show "Beyond".

 

This is what my measure currently looks like, but it is not correct: 

Fits in =
VAR SelectedTeam = SELECTEDVALUE(Teams[Team])
VAR RemPtsRT = CALCULATE([RemPts_RT], 'Features Open'[Team] = SelectedTeam)
VAR CapRT = CALCULATE([Cap_RT], Capacity[Team] = SelectedTeam) RETURN
IF (RemPtsRT <= CapRT, "Fits in S"& RIGHT(CALCULATE(MAX(Capacity[Yr\Sprint])),2), "")
 
Here is a screenshot of the 2 tables with the Expected/Desired result in the first table.   
Alicia_Anderson_0-1723656108038.png

 

 
Here is a picture of the relationhships.
Alicia_Anderson_0-1723662159354.png

 

1 ACCEPTED SOLUTION

Thanks for the assist.   This actually worked when I used it as a measure. 

View solution in original post

6 REPLIES 6
Alicia_Anderson
Resolver I
Resolver I

This is a table representation of the screenshot above...

IndexF_IDF_StateEffortChdPtRemRemPtsRun TotalFits inEXPECTED RT left<=RT right (last 2 digits of Yr\Sprint) Yr\SprintCapRTRow#
18543747Committed21222Fits in S17Fits in S17 2 <= 29 (row 1= 2024\17) 2024\1729291
28633585Committed34131315Fits in S17Fits in S17 15 <= 29 (row 1= 2024\17) 2024\1829582
38768829Committed55171732 Fits in S18 32 <= 58 (row 2= 2024\18) 2024\1932903
48697798In Progress21  32Fits in S16Fits in S18 32 <= 58 (row 2= 2024\18) 2024\20321224
58716443Analyzing21132153Fits in S18Fits in S18 53 <= 58 (row 2= 2024\18) 2024\21311535
68715146Committed185558Fits in S17Fits in S18 58 <= 58 (row 2= 2024\18) 2024\22321856
78716210Committed349967 Fits in S19 67 <= 90 (row 3= 2024\19) 2024\23312167
88716203Committed21111178Fits in S18Fits in S19 78 <= 90 (row 3= 2024\19) 2024\24402568
98669412Committed344545123Fits in S27Fits in S21 123 <= 153 (row 5= 2024\21) 2024\25342909
108710016Committed211212138Fits in S20Fits in S21 138 <= 153 (row 5= 2024\21) 2024\263732710
118773530Committed633138 Fits in S21 138 <= 153 (row 5= 2024\21) 2024\273636311
128651185Committed348080218Fits in S27Fits in S21 218 <= 256 (row 8= 2024\24) 2025\014040312
138543757Committed1366224 Fits in S24 224 <=256 (row 8= 2024\24) 2025\024044313
148576248Committed21  224 Fits in S24 224 <=256 (row 8= 2024\24) 2025\034048314
158657004Analyzing21 21245 Fits in S24 245 <=256 (row 8= 2024\24) 2025\044052315
167928541Approved212021266 Fits in S25 266 <=290 (row 9= 2024\25) 2025\054056316
178389242Committed553030296 Fits in S26 296 <=327 (row 10= 2024\26) 2025\064060317
188576235Ready 3535331 Fits in S27 331 <=363 (row 11= 2024\27) 2025\074064318
198693189New 1515346 Fits in S27 346 <=363 (row 11= 2024\27) 2025\084068319
208576222Analyzing888354 Fits in S27 354 <=363 (row 11= 2024\27) 2025\094072320
218576234Analyzing 1919373 Fits in S01 373 <=403 (row 12= 2025\01) 2025\104076321

hello @Alicia_Anderson 

 

please check if this accomodate your need.

Irwan_0-1723686474011.png

 

create new calculated column with following DAX

Expected =
var _Value =
MINX(
    FILTER(
        'Capacity',
        'FeaturedOpen'[Run Total]<='Capacity'[RT]
    ),
    'Capacity'[Yr\Sprint]
)
var _RightText = RIGHT(_Value,2)
var _AddText = CONCATENATE("Fits in S",_RightText)
Return
_AddText
_Value is meant to find out the matching value.
_RightText is defining two right number on Yr\Sprin.
_AddText is for adding text "Fits..."
 
Hope this will help.
Thank you.

Thanks for the assist.   This actually worked when I used it as a measure. 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

I have read the suggested article and still can't figure out how to provide access to the PBIX.  I revised my initial post and also posted an extract of the 2 tables from Excel. 

Please simplify your sample data, remove anything not related to the issue. 
Please show the expected outcome based on the sample data you provided.

 

Note: Power BI is a reporting tool. It is not a resource planning tool.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.