Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Measure using averages calculated individually

I have two data tables, one with manufacturing data and one with detailed scrap reasons. I wrote this measure to calculate the cost of scrap by multiplying the numbers of scrap per item code and the average cost of the parts also by item code, but I want it to average the part cost by item code since now it's averaging the cost of everything together if I use my slicer to pick multiple product codes (which may consist of multiple item numbers). How could I edit this so that it averages the part cost and multiplies it by the sum of rejects for each item number within a product code. I have an active relationship between the two tables for machine, and another for item #/PARTNO.

 

Total Cost = CALCULATE(SUM('Scrap Reasons'[Rejects]) * AVERAGE('Data Dump'[DAY_PT_COST]),USERELATIONSHIP('Data Dump'[PARTNO],'Scrap Reasons'[Item #]),FILTERS('Data Dump'[PARTNO]),FILTERS('Scrap Reasons'[Item #]))

1 Reply

  • Anonymous can you share how the relationship is done for these tables? It will be helpful if you share sample data and expected output and get you a solution.