Forum Discussion
Weighed Average for User Feedback
- 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 / aLast 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
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