Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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
  • Hi Anonymous ,

     

    Please refer to my .pbix file.

     

    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.

6 Replies

  • 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's avatar
      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?

    • Anonymous's avatar
      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
    • v-lionel-msft's avatar
      v-lionel-msft
      Icon for Community Support rankCommunity Support

      Hi Anonymous ,

       

      Please refer to my .pbix file.

       

      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.