Forum Discussion

JNelson's avatar
JNelson
Icon for Helper II rankHelper II
4 years ago

Dividing rows/measures

Hello,

 

I have data pulling through from an online source of our accounting system. I am trying to divide each row's [Cost] by [Quantity Produced] to get a unit rate. I am having trouble getting it to calculate for each row, it's only producing the Total unit rate. I have a filter applying to the date of the data too. 

 

Example of the data:

[Quantity Produced] = 3,000

Material/Account CodeCostCurrent outcomeIdeal outcome (Cost / Qty)

Material A

$40,000infinity$13.33
Material B$60,000infinity$20.00
Material C$5,000infinity$1.67
Material D$2,000infinity$0.67
Total$107,000$35.67$35.67

 

Thanks in advance!

3 Replies

  • JNelson , You should not use measure in calculated column you should create a measure

     

    divide([Qty Meausre], Sum(Table[Cost])

     

     

    Line level measure

    Sumx(Table, Divide([Qty Measure], [Cost])

     

    or

     

    AverageX(Table, Divide([Qty Measure], [Cost])

    • JNelson's avatar
      JNelson
      Icon for Helper II rankHelper II

      Thank you amitchandak .

       

      So it is not possible to get the unit rates against each item? I've tried each dax you provided and they're not working. Could it be because the Cost and Quantity measures are in different tables?  The SUMX formula just yields blank entries in the table.

       

      Thanks