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

Text lookup between two columns to sum values

Hi All,

 

You have all been proven to be much smarter than me lately. I appreciate anyone who can help with this.. basically I have the below table which is bills of material. The first column is the product that the recipe is for. The second column is the raw material in the recipe with the cooresponding Quantity of that raw material in the recipe. Then finally I have the cost column for the raw material. Sometimes we have intermediates, which are just when we put a recipe product (column A) inside of another product as part of the recipe. Can someone tell me how I can fill in the cost of raw material ABC? Hope this made sense. 

 

Recipe ProductRaw MaterialQTY %Intermediate (Isolated)Cost (of Raw Material)/lb
ABC12310%  $                                                                                1.25
ABC21420%  $                                                                                1.50
ABC56470%  $                                                                                1.30
CBEABC80%ABC(Need cost of all of ABC here which is $4.05)
CBE56810%  $                                                                                1.80
CBE65910%  $                                                                                2.10
1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_1-1611815406817.png

 

Best regards,
Lionel Chen

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

6 REPLIES 6
Anonymous
Not applicable

@amitchandak @v-lionel-msft @parry2k 

 

I have attached a test file which shows exactly what I am trying to accomplish. Can any of you help? Again, I really appreciate your time. Below is a snip of what is in my test file. 

 

Kabartz_0-1611157043568.png

Power BI Test File 

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_1-1611815406817.png

 

Best regards,
Lionel Chen

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

v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Or do like this. Please refer to my .pbix file.

v-lionel-msft_0-1611043110144.png

 

Best regards,
Lionel Chen

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

Anonymous
Not applicable

Thanks a ton for taking the time to put this together. I think this is really close.. so all of my first 4 columns are in the same table (exactly like the below). The Cost (of raw material)/lb is actually a measure from a completely different table that has a list of Raw materials and cost/lb for each raw material, the measure takes the cost of the raw material and averages it by month (to get an average cost per month). This measure is then brought in the matrix table to give the avg cost/lb of each raw material. I will have instances in my data where there will be many different intermediates so classifying them as X may yield an incorrect answer when there are many (not just one), does that make sense?

 

Recipe ProductRaw MaterialQTY %Intermediate (Isolated)Cost (of Raw Material)/lb
ABC12310%  $                                                                                1.25
ABC21420%  $                                                                                1.50
ABC56470%  $                                                                                1.30
CBEABC80%ABC(Need cost of all of ABC here which is $4.05)
CBE56810%  $                                                                                1.80
CBE65910%  $                                                                                2.10
amitchandak
Super User
Super User

@Anonymous , A new column like

 

new column =
var _i = [Intermediate (Isolated)]
return
if([Intermediate (Isolated)] = [Product Raw], Sumx(filter(Table,[Recipe] =_1),[Cost (of Raw Material)/lb]), blank())

Anonymous
Not applicable

Thanks for the quick reponse! I suppose I should have mentioned this before, my bad. What if my Cost/lb is actually a measure? I have a relationship in my model connecting two tables and a measure that gives me my cost/lb for each raw material (I know this measure/relationship between tables is working because it displays all my cost/lb correctly for all raw materials). With this new info, I probably can't create a new column refrencing a measure that brings in data from another table correct?

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.