Forum Discussion

SrinivasK's avatar
SrinivasK
New Member
2 years ago
Solved

Calculate weighted average based on another field

I have product wise volume and certain budget allocated on it but need to find prorpotion of this budget by calculating share of volume in total volume. I tried few variations of this - using Allsel...
  • ahadkarimi's avatar
    2 years ago

    Hi SrinivasK , try this measure below, and if you encounter any issues, let me know.

    Weighted Avg = 
    VAR TotalVol = CALCULATE(SUM(Table[Vol]), ALL(Table))
    RETURN
    SUMX(
        Table,
        DIVIDE(Table[Vol], TotalVol) * Table[Budget]
    )

    Did I answer your question? If so, please mark my post as the solution! ✔️
    Your Kudos are much appreciated! Proud to be a Solution Supplier!

  • SrinivasK's avatar
    2 years ago

    Thanks ahadkarimi for your answer. I changed All to Allselected on Total var and it worked. I guess since there are filters applied, on the matrix, the allselected worked.