Forum Discussion

Sandeep_PowerBI's avatar
Sandeep_PowerBI
Frequent Visitor
3 years ago
Solved

SumProduct with Power BI

Hi Team,   Please help me with SUMPRODUCT similar with excel in DAX measure... Below are my Actuals in Main Category and Lines. How to get weighted average using SUMPRODUCT logic in DAX command? I...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Sandeep_PowerBI ,

     

    In Power BI, you need to use unpivot and pivot for your data first, and then you can perform calculations.

    After transformation, the data is as follows.

    Create this measure:

    Measure =
    VAR _table =
        SUMMARIZE (
            'Table',
            [Line],
            [ABC],
            [HMP],
            "Product", SUM ( 'Table'[ABC] ) * SUM ( 'Table'[HMP] )
        )
    RETURN
        DIVIDE (
            SUMX ( _table, [Product] ),
            SUMX ( FILTER ( ALL ( 'Table' ), [Line] = MAX ( 'Table'[Line] ) ), [HMP] )
        )
    

     

       

                                                                                                                                                             

    Best Regards,

    Stephen Tao

     

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