Forum Discussion

Kaitra's avatar
Kaitra
Frequent Visitor
6 years ago
Solved

Weighed Average for User Feedback

Dear all,   I have read some articles here in regards of the weighed average DAX expression. But I was not able to get the needed solution (or I am just not skilled enough). My current situtaion i...
  • v-deddai1-msft's avatar
    6 years ago

    Hi Kaitra ,

     

    First try to unpivot your table:

     

    Then create a calculated column for weighted:

     

     

    weighted =
    VAR a =
        CALCULATE (
            COUNT ( 'Table'[Supplier] ),
            ALLEXCEPT ( 'Table', 'Table'[Question], 'Table'[Supplier] )
        )
    VAR b =
        CALCULATE (
            COUNT ( 'Table'[Supplier] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Question], 'Table'[Supplier] ),
                'Table'[Value] = EARLIER ( 'Table'[Value] )
            )
        )
    RETURN
        b / a

     

     

    Last create the measure for WAC:

     

    WAC = SUMX(SUMMARIZE('Table','Table'[Supplier],'Table'[Question],'Table'[Value],'Table'[weighted],"weightedvalue",'Table'[Value]*'Table'[weighted]),[weightedvalue])

     

     

     

    For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Ec9jvEYkrDBGh-4Ghsieaa4BELptGFAnzBcf7rayyZLQ5A?e=KW2PHI

     

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

     

    Best Regards,

    Dedmon Dai