Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Calculating Average Price Per Ton

I have 5 facilities that produce the same product.   I have one table with all the maintenance costs for that facility for each month.  I have another table that has the tons produces by each facilit...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous - Try the following:

    1. Create separate Dimension tables for Date and Facility. There are many scripts available for creating a date table in DAX or Power Query. Facility would be a distinct list of the facilities in either table.

    2. Create Relationships (1:M) between each dimension table and each fact table.

    3. Create your measure:

    Maintenance Cost/SGT = 
    var num = SUM('Maintenance costs'[Debit Amt])
    var den = SUM('Chips Produced'[Chips Shipped])
    return DIVIDE(num,den)

    Hope this helps,

    Nathan

     

     

  • Anonymous's avatar
    Anonymous
    7 years ago

    If you still have the relationship between the 2 original tables, you'll need to remove that prior to creating the new relationships. Sorry I forgot that step earlier.

  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous  - Your date table needs a column that will correspond to each month, but be sorted chronologically. I prefer an integer value like 201906, which you can obtain by the following:

    year*100 + month.

    Then use this column as the Sort By column for month/year.

    Cheers!

    Nathan