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

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

Reply
Winter_king94
Helper I
Helper I

Match on 3 columns and return value/ add row if no match

I am working with two tables that cannot be joined together using the many to many cardinatlity. My two tables (shipped sales & backlog sales) are both joined to a third table (item).

 

I am trying to pull in 2 columns (2024 Backlog QTY & 2024 Backlog Revenue) from my Backlog Sales table into my Shipped Sales table based on 3 columns matching between the two tables (Bill to Customer, End Customer, Item Num), or 2 columns (Bill to Customer, End Customer) matching between the two tables as the item number isn't always present across both tables. I've tried using the below to create a calculated column but this is summing the values instead of bringing them directly over. It only shows the correct values when I have them set to 'Average', but then this fudges up the total. 

'24 Backlog QTY = CALCULATE('DOV CPU Backlog Report'[2024 Backlog Quantity],
Filter ('DOV CPU Backlog Report', 'DOV CPU Backlog Report'[Customer Name] = 'Oracle KE24 Data'[Bill To Customer Name] && 'DOV CPU Backlog Report'[SALES ORDER LINE ITEMS.PROD_DW_CPC.T_CUSTOMER_D(END_CUSTOMER_SKEY).CUSTOMER_ACCO] = 'Oracle KE24 Data'[End Customer Name] && 'DOV CPU Backlog Report'[Item] = 'Oracle KE24 Data'[Item Num]))

 

Winter_king94_1-1727877462689.png

 

Any and all help is greatly appreciated!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Winter_king94 

Based on your information, I create sample tables:

Backlog Sales

vyohuamsft_0-1728462805059.png

Shipped Sales

vyohuamsft_1-1728462819610.png

Bridge Table (Item)

vyohuamsft_2-1728462833884.png

 

Then create relationship:

vyohuamsft_3-1728462994090.png

 

Create new measures, try the following DAX expression:

24 Backlog QTY = 
CALCULATE(
    SUM('Backlog Sales'[2024 Backlog Quantity]),
    FILTER(
        'Backlog Sales',
        'Backlog Sales'[Bill to Customer] = MAX('Shipped Sales'[Bill to Customer]) &&
        'Backlog Sales'[End Customer] = MAX('Shipped Sales'[End Customer]) &&
        (ISBLANK(MAX('Shipped Sales'[Item Num])) || 'Backlog Sales'[Item Num] = MAX('Shipped Sales'[Item Num]))
    )
)
24 Backlog Revenue = 
CALCULATE(
    SUM('Backlog Sales'[2024 Backlog Revenue]),
    FILTER(
        'Backlog Sales',
        'Backlog Sales'[Bill to Customer] = MAX('Shipped Sales'[Bill to Customer]) &&
        'Backlog Sales'[End Customer] = MAX('Shipped Sales'[End Customer]) &&
        (ISBLANK(MAX('Shipped Sales'[Item Num])) || 'Backlog Sales'[Item Num] = MAX('Shipped Sales'[Item Num]))
    )
)

 

Put Shipped Sales fields in Table visual, and also put these measures in Table viusal, here is my preview:

vyohuamsft_4-1728463167010.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @Winter_king94 -you have a many-to-many relationship, you can create a bridge table with distinct keys to help relate Table A and Table B.

Table C (Item) should act as a bridge table between Table A (Shipped Sales) and Table B (Backlog Sales).
Ensure that Table C contains the unique values of Item Num (and possibly Bill to Customer and End Customer) that exist in both tables.

For 2024 Backlog QTY you can use below measure:

24 Backlog QTY =
CALCULATE(
SUM('DOV CPU Backlog Report'[2024 Backlog Quantity]),
FILTER(
'DOV CPU Backlog Report',
'DOV CPU Backlog Report'[Customer Name] = 'Oracle KE24 Data'[Bill To Customer Name] &&
'DOV CPU Backlog Report'[End Customer Name] = 'Oracle KE24 Data'[End Customer Name] &&
(ISBLANK('Oracle KE24 Data'[Item Num]) ||
'DOV CPU Backlog Report'[Item] = 'Oracle KE24 Data'[Item Num])
)
)

For 2024 Backlog Revenue use below calculation similar logic

24 Backlog Revenue =
CALCULATE(
SUM('DOV CPU Backlog Report'[2024 Backlog Revenue]),
FILTER(
'DOV CPU Backlog Report',
'DOV CPU Backlog Report'[Customer Name] = 'Oracle KE24 Data'[Bill To Customer Name] &&
'DOV CPU Backlog Report'[End Customer Name] = 'Oracle KE24 Data'[End Customer Name] &&
(ISBLANK('Oracle KE24 Data'[Item Num]) ||
'DOV CPU Backlog Report'[Item] = 'Oracle KE24 Data'[Item Num])
)
)

above measure should pull the correct revenue from Table B based on the matching columns.Set up a one-to-many relationship between the bridge table and both Table A and Table B.If aggregation issues exists, double-check your data relationships and ensure that the fields used for matching (Bill to Customer, End Customer, and Item Num) are correctly formatted and joined.

 

Hope the above pointers helps.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi, thank you for your help! 

I am unfortunately struggling with creating the measure. 

When I add this line: 

FILTER('DOV CPU Backlog Report', 'DOV CPU Backlog Report'[Customer Name] = 'Oracle KE24 Data'.... PBI isn't letting me select 'Oracle KE24 Data'[Bill To Customer Name]. It's only allowing me to select other measures. Can you help me understand why that might be?
 
Does the relationship from Table A or Table B to the bridge table need to have an active status?
I feel like I am missing something basic, but I have only been using PBI for 2 months so any tips are greatly appreciated!
Anonymous
Not applicable

Hi, @Winter_king94 

Based on your information, I create sample tables:

Backlog Sales

vyohuamsft_0-1728462805059.png

Shipped Sales

vyohuamsft_1-1728462819610.png

Bridge Table (Item)

vyohuamsft_2-1728462833884.png

 

Then create relationship:

vyohuamsft_3-1728462994090.png

 

Create new measures, try the following DAX expression:

24 Backlog QTY = 
CALCULATE(
    SUM('Backlog Sales'[2024 Backlog Quantity]),
    FILTER(
        'Backlog Sales',
        'Backlog Sales'[Bill to Customer] = MAX('Shipped Sales'[Bill to Customer]) &&
        'Backlog Sales'[End Customer] = MAX('Shipped Sales'[End Customer]) &&
        (ISBLANK(MAX('Shipped Sales'[Item Num])) || 'Backlog Sales'[Item Num] = MAX('Shipped Sales'[Item Num]))
    )
)
24 Backlog Revenue = 
CALCULATE(
    SUM('Backlog Sales'[2024 Backlog Revenue]),
    FILTER(
        'Backlog Sales',
        'Backlog Sales'[Bill to Customer] = MAX('Shipped Sales'[Bill to Customer]) &&
        'Backlog Sales'[End Customer] = MAX('Shipped Sales'[End Customer]) &&
        (ISBLANK(MAX('Shipped Sales'[Item Num])) || 'Backlog Sales'[Item Num] = MAX('Shipped Sales'[Item Num]))
    )
)

 

Put Shipped Sales fields in Table visual, and also put these measures in Table viusal, here is my preview:

vyohuamsft_4-1728463167010.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors