Forum Discussion

shanestocks's avatar
shanestocks
Helper I
2 years ago
Solved

Weighted Average by Code

Hi guys, I am having an issue with correcting the weighted average in a calculation. I have a hierarchy, P code, and then meat code. Multiple meat codes can make up a P code, and each meat code has i...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi shanestocks ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:

    Based on the measure you created I created a variance measure

    variance = ABS(([Act.]-SELECTEDVALUE(fUsage[standard_price]))*SUM(fUsage[req_qty]))

    The act measure you wrote before is correct.
    Final output

    If the variance that ultimately shows 2919 at the p_code level is not correct, could you please provide more details on how Sub,Req was created, preferably in a pbix file, please hide private information in advance, and the same please provide your expected results in excel

    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly