Reply
GiaD30
Helper I
Helper I
Partially syndicated - Outbound

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*Column C) /Total Sum column C for each month.

 

How can I calculate Weighted average using 

 

DateColumn BColumn Cweighted average
2/3/2024101001.052631579
2/4/2024151201.894736842
2/5/2024232004.842105263
2/6/2024122102.652631579
2/7/2024113203.705263158
3/3/2024222505.97826087
3/4/2024402008.695652174
3/5/2024451155.625
3/6/2024331374.914130435
3/7/202492182.132608696
1 ACCEPTED SOLUTION
v-pnaroju-msft
Community Support
Community Support

Syndicated - Outbound

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:

vpnarojumsft_0-1743441364748.png

vpnarojumsft_1-1743441378845.png


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.

View solution in original post

9 REPLIES 9
v-pnaroju-msft
Community Support
Community Support

Syndicated - Outbound

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:

vpnarojumsft_0-1743441364748.png

vpnarojumsft_1-1743441378845.png


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.

Syndicated - Outbound

Thank you very much everyone for all the help, it is working now.

Ashish_Mathur
Super User
Super User

Syndicated - Outbound

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1743120334946.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ThxAlot
Super User
Super User

Syndicated - Outbound

ThxAlot_0-1743106870724.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Syndicated - Outbound

@ThxAlot  thank you so much,now I am asking, what if we need to consider other columns, like category, sub category and month/year. 

I have added extra columns and would like to attach again the pbi, but don;t know how.Capture.JPG

GiaD30
Helper I
Helper I

Syndicated - Outbound

@bhanu_gautam thank you so much for your reply, unfortunately, the result is the same with the numbers from column B, I also tried something similar.

I need the result from column Weighted average from my table below.

 

DateColumn BColumn Cweighted average
2/3/2024101001.052631579
2/4/2024151201.894736842
2/5/2024232004.842105263
2/6/2024122102.652631579
2/7/2024113203.705263158
3/3/2024222505.97826087
3/4/2024402008.695652174
3/5/2024451155.625
3/6/2024331374.914130435
3/7/202492182.132608696
bhanu_gautam
Super User
Super User

Syndicated - Outbound

@GiaD30 

Create a new column for the weighted value: This column will be the product of Column B and Column C.

WeightedValue = [Column B] * [Column C]

 

Create a new measure for the total sum of Column C by month: This measure will calculate the total sum of Column C for each month.

TotalSumColumnC = CALCULATE(SUM('Table'[Column C]), ALLEXCEPT('Table', 'Table'[Date].[Month]))

 

Create a new measure for the weighted average by month: This measure will calculate the weighted average using the previously created columns and measures.

WeightedAverage = DIVIDE(SUM('Table'[WeightedValue]), [TotalSumColumnC])




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






pankajnamekar25
Continued Contributor
Continued Contributor

Syndicated - Outbound

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 )
 
 
pankajnamekar25_0-1743087232141.png

 

Thanks,
Pankaj

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

Syndicated - Outbound

@pankajnamekar25 Thank you so much for the help, unfortunately, using the code above, exactly like this, is not working...

    MONTH( 'Table'[Date] ) = MONTHMAX( 'Table'[Date] ) )
            && YEAR( 'Table'[Date] ) = YEARMAX( 'Table'[Date] ) )
        ),
        'Table'[Column B] * 'Table'[Column C]    here this part is not allowing me
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)