Forum Discussion

awitt's avatar
awitt
Helper III
4 years ago
Solved

True Allocated Average

Trying to return the Allocated Cost Per OrderID column because the value in the "Cost" column is the total final cost for the Tracking Number. Essentially you divide the Cost value by however many unique orderID's there are per tracking number. Seems simple but I cant figure it out. 

 

Tracking NumberOrderIDCostAllocated Cost Per OrderID
12345678909100130.515.25
12345678909100230.515.25
98765432410038020
98765432410048020
98765432410058020
98765432410068020
2.34873E+1210071818
  • awitt you can add a column using following expression:

     

    Allocated Cost per order id = 
    VAR __numberofOrders = CALCULATE ( COUNTROWS ( YourTable ), ALLEXCEPT ( YourTable, YourTable[TrackingNumber] ) )
    RETURN
    DIVIDE ( YourTable[Cost], __numberofOrders )

     

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

1 Reply

  • awitt you can add a column using following expression:

     

    Allocated Cost per order id = 
    VAR __numberofOrders = CALCULATE ( COUNTROWS ( YourTable ), ALLEXCEPT ( YourTable, YourTable[TrackingNumber] ) )
    RETURN
    DIVIDE ( YourTable[Cost], __numberofOrders )

     

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.