Forum Discussion
GiaD30
1 year agoHelper II
Weighted average by month
Hello everyone, Please, can you guide/help me? I have the below table and I need to calculate the weighted average by month, the formula in excel for the Weighted average by month = (Column B*Co...
- 1 year ago
Thank you, pankajnamekar25 , bhanu_gautam , ThxAlot , and Ashish_Mathur , for your responses.
Hi GiaD30,
Please find attached the screenshots and PBIX file, which may help in resolving the issue:
If you find our response helpful, kindly mark it as the accepted solution and give kudos. This will assist other community members facing similar queries.Thank you.
pankajnamekar25
1 year agoSuper User
Hello GiaD30
You can try this measure
Weighted Average by Month =
VAR TotalWeightedSum =
SUMX(
FILTER( 'Table',
MONTH( 'Table'[Date] ) = MONTH( MAX( 'Table'[Date] ) )
&& YEAR( 'Table'[Date] ) = YEAR( MAX( 'Table'[Date] ) )
),
'Table'[Column B] * 'Table'[Column C]
)
VAR TotalWeight =
SUMX(
FILTER( 'Table',
MONTH( 'Table'[Date] ) = MONTH( MAX( 'Table'[Date] ) )
&& YEAR( 'Table'[Date] ) = YEAR( MAX( 'Table'[Date] ) )
),
'Table'[Column C]
)
RETURN
DIVIDE( TotalWeightedSum, TotalWeight, 0 )
Thanks,
Pankaj
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
GiaD30
1 year agoHelper II
pankajnamekar25 Thank you so much for the help, unfortunately, using the code above, exactly like this, is not working...
MONTH( 'Table'[Date] ) = MONTH( MAX( 'Table'[Date] ) )
&& YEAR( 'Table'[Date] ) = YEAR( MAX( 'Table'[Date] ) )
),
'Table'[Column B] * 'Table'[Column C] here this part is not allowing me