Forum Discussion

mistretta's avatar
mistretta
Frequent Visitor
10 years ago
Solved

Need Help with Calculated Measure

EDIT:   Let's just start from the beginning with a new example rather than trying to throw in Vendors to the mix of my original fruit example. We will stick with food and weight to keep it consiste...
  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    10 years ago

    Hi mistretta,

     

    In your scenario, you can built a relationship between Table A and Table B as 1:N, then create a measure in Table B like below:

     

    Total = SUMX('Table B',CALCULATE(SUM('Table B'[REQUIRED OUNCES]))*RELATED('Table A'[COST PER OUNCE]))

     

    Of you can create a table from the Table B, build a relationship between Table A and new table as 1:1, then create a measure. See:

     

    Table = SUMMARIZE('Table B','Table B'[ITEM / INGREDIENT],"Total OUNCES", SUM('Table B'[REQUIRED OUNCES]))

     

    TotalCost = SUMX('Table A','Table A'[COST PER OUNCE]*RELATED('Table'[Total OUNCES]))

     

     

     

    Best Regards,
    Qiuyun Yu