Forum Discussion
Weighted Average
- 3 years ago
DerekC try this measure:
Count Measure = COUNTROWS ( Table ) Total Count Measure = CALCULATE ( [Count Rows], ALLSELECTED () ) Dwell x Wgt% Measure = SUMX ( Table, VAR __dwellTime = Table[Dwell Time] VAR __dwellCount = CALCULATE ( [Count Measure], ALLSELECTED (), VALUES ( Table[Dwell Time] ) ) VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] ) RETURN __weightPercent * __dwellTime )✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
DerekC try this measure:
Count Measure = COUNTROWS ( Table )
Total Count Measure = CALCULATE ( [Count Rows], ALLSELECTED () )
Dwell x Wgt% Measure =
SUMX (
Table,
VAR __dwellTime = Table[Dwell Time]
VAR __dwellCount = CALCULATE ( [Count Measure], ALLSELECTED (), VALUES ( Table[Dwell Time] ) )
VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] )
RETURN
__weightPercent * __dwellTime
)
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
Thank you very much. I had to add another measure to get the result I wanted, but this got me 90% of the way there.
I broke out the weighted percent variable into its own measure.
VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] )
Then, then I had to create a new measure to SUMX the weighted percent and divide by the SUMX of the Dwell x wgt% Measure you helped me create.