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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Select value from another Table for operation.

Hello All,

 

I have two tables as below.Have not listed all the columns in them.I need to get the price from the Price table for each of the part in the Order table and create a new column with that.Merging the tables would work but is there any other way?

Thanks for helping

PartOrderQtyNew Column(QTY*Price
123ABC55
345XYZ612
678PQR721

 

Part Price
1231
3452
6783
2344
5675

 

Thanks

 

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a calculated column in Order table as below.

Column =
VAR pri =
    CALCULATE (
        MAX ( Price[Price] ),
        FILTER ( Price, Price[Part ] = 'Order'[Part] )
    )
RETURN
    'Order'[Qty] * pri

Capture.PNG

 

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

5 REPLIES 5
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a calculated column in Order table as below.

Column =
VAR pri =
    CALCULATE (
        MAX ( Price[Price] ),
        FILTER ( Price, Price[Part ] = 'Order'[Part] )
    )
RETURN
    'Order'[Qty] * pri

Capture.PNG

 

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

@v-frfei-msft Thanks.That was helpful and worked.

parry2k
Super User
Super User

@Anonymous assuming you have relationship between these two tables, Part table is on one side of the relationship, you can use expression to add new calculated column in your table

 

New Column Qty x Price = 
Table[Qty] * RELATED ( Part[Price] )

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thanks.There is a many to many relationship and guess Related does not work well with this relationship as i get error.

The column  either doesn't exist or doesn't have a relationship to any table available in the current context.

@Anonymous many to many is surely the issue, not sure why you have many records for a part number in part table.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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