Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Weighted Average DAX Expression

Dear All,

i have list of multiple category to calculate Weighted Averages, to calculate Weighted avg first i have to filter Month, SKU, then Traders In excel. i applied Sumproduct formula and i am getting exect Weighted Avg Number.

But when i tried to apply DAX Expression i am not getting the exact number. 

Weighted Average =

DIVIDE (

SUMX ( 'Table', [SumMillion Ton] * [Rate Per] ),
SUMX ( 'Table', [Million Ton] )
)   

Kindly help to resolve this query.

 

Thanks in Advance  

  • tamerj1's avatar
    tamerj1
    4 years ago

    Anonymous 
    Then my original DAX formula should give the exct result.

18 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    please try

    Weighted Average =
    VAR CurrentTable =
        CALCULATETABLE (
            'Table',
            ALLEXCEPT ( 'Table', 'Table'[Traders Name], 'Table'[SKU], 'Table'[Month] )
        )
    RETURN
        DIVIDE (
            SUMX ( CurrentTable, [SumMillion Ton] * [Rate Per] ),
            SUMX ( CurrentTable, [Million Ton] )
        )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Dear Tamerj,

      Thanks for the update, As i have applied the fourmula which you provided but still i am not getting the exact value.    

      • tamerj1's avatar
        tamerj1
        Community Champion

        Hi Anonymous 
        Can you please advise what is the formula that you have used in excel for the numerator and the denominator?