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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Hayashi123
New Member

Lookup in another table and then net results if applicable

Hi. New to Power BI and would appreciate any advice and guidance on this.

 

I am trying to lookup the Buy User Ids in Table 1 in Table 2 and if the Buy User ID is in Table 1 matches the Sell User ID in Table 2 then net the Amounts and gives the "Exp Results" in Table 1.

 

 

 

Hayashi123_0-1710085799344.png

 

 

2 ACCEPTED SOLUTIONS
Dangar332
Super User
Super User

HI, @Hayashi123 

 

your information is not appropriate but try below

first make sure sellerid and user id tables is connected with eachother
and use below code for new column

 

Column = 
var a = LOOKUPVALUE(seller[amount],seller[sellerid],user[userid])
return
user[amount]-a

 

 

Dangar332_0-1710087875632.png

 

 

View solution in original post

Anonymous
Not applicable

HI @Hayashi123,

Perhaps you can try to use the IN operator to compare the selected value and calculate with current values.
Measure formula sample :

formula =
VAR currAmount =
    SUM ( User[amount] )
VAR selected =
    CALCULATE (
        SUM ( Seller[Amount] ),
        FILTER ( ALLSELECTED ( Seller ), [User ID] IN VALUES ( User[User ID] ) )
    )
RETURN
    currAmount - selected

The IN operator in DAX - SQLBI

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Dangar332
Super User
Super User

HI, @Hayashi123 

 

your information is not appropriate but try below

first make sure sellerid and user id tables is connected with eachother
and use below code for new column

 

Column = 
var a = LOOKUPVALUE(seller[amount],seller[sellerid],user[userid])
return
user[amount]-a

 

 

Dangar332_0-1710087875632.png

 

 

Thank you for your reply.  It worked however, I wanted to do a sum lookup.  So in the Seller table there could be multiple rows with a Seller User ID and varying amounts.  

Anonymous
Not applicable

HI @Hayashi123,

Perhaps you can try to use the IN operator to compare the selected value and calculate with current values.
Measure formula sample :

formula =
VAR currAmount =
    SUM ( User[amount] )
VAR selected =
    CALCULATE (
        SUM ( Seller[Amount] ),
        FILTER ( ALLSELECTED ( Seller ), [User ID] IN VALUES ( User[User ID] ) )
    )
RETURN
    currAmount - selected

The IN operator in DAX - SQLBI

Regards,

Xiaoxin Sheng

StrategicSavvy
Resolver II
Resolver II

hi @Hayashi123 

I think you need provide more context because I cannot understand the logic of expected results. But if you would like to lookup you will have 2 options:

1. Create one to one relationship between buer and seller - my assumtions is they have 1-1 relationship based on your case. Then you can create either create measure that will calculate lookup value or create column in your table A with RELATED formula

 

2. Use merge operation in Power Query to join two datasets and name new column as Exp Results.

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: www.linkedin.com/in/lukasz-kozdron 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.