Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mciani
Regular Visitor

Calculate dynamic Weighted Average of a Measure vs the Total

Hi community,

 

I have read tons of posts but I cannot find a solution to my issue.

 

I'm trying to calculate the % of a row value, resulting from a measure in a Matrix, vs the column total.

In excel, it will looks like the following:

ChannelTrade SpendWA
Coop e Gruppi T.O. 1.030.06114,99%
Corner MM 513.7287,48%
Dirette 1.977.29328,78%
E-commerce 485.5557,07%
Ingrosso 927.85013,51%
Intercompany 00,00%
Mass Market 1.644.97723,95%
Others 1380,00%
Total6.869.443100,00%

 

where WA is the result of the following formula:

=B2/$B$10.

 

The trade spend column is a measure that sums other measures.

is there a way to replicate the same output in PBI?

 

Thank you all for your suggestion!

Marco

1 ACCEPTED SOLUTION

Hi, @mciani 

Thank you for your feedback.

You can also try the below.

 

WA percentage V2 =
DIVIDE (
[TRADE SPEND],
CALCULATE ( [TRADE SPEND], ALLSELECTED ( PowerBI_Total_PL) )
)
Then, you can change the Channel column to the Month column, for instance.
 
However, I am not quite sure if it gives the correct answer for all situations. Because the measures that are related to [TRADE SPEND] have quite a lot of conditions. It is really hard to tell whether it will still show the correct result if ALLSELECTED is used with the main fact table.
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

8 REPLIES 8
Jihwan_Kim
Super User
Super User

Hi, @mciani 

Please check the below picture and the sample pbix file's link down below.

 

Picture7.png

WA Percentage =
DIVIDE (
SUM ( Data[Trade Spend] ),
CALCULATE ( SUM ( Data[Trade Spend] ), ALL ( Data ) )
)
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi Jihwan,

 

I see you created a data table and build a calculation in dax that is using the SUM function.

I cannot use SUM as the value I need to reference to is a Measure. Is there any other way to do the same with the measure?

I can provide the pbix if it's easier

Hi, @mciani 

Thank you for your feedback.

SUM ( Data[Trade Spend] ) is a measure and you can try to replace this to your measure.

I am not sure how your measure is related to the column, so that is why I created a sample by myself.

Please share your sample pbix file, then I can try to come up with a more accurate measure.

Thank you.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks for your support @Jihwan_Kim .

Here is the link to the pbix file.

 

 

Thanks again

Hi, @mciani 

Thank you for sharing.

Please check the below picture and the pbix file's link down below whether it is what you are looking for.

 

 Picture4.png

 

WA percentage =
DIVIDE (
[TRADE SPEND],
CALCULATE ( [TRADE SPEND], ALLSELECTED ( PowerBI_Customer[Channel] ) )
)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim ,

 

that is exactely what I was looking for! THANK YOU!

One last thing. In the formula you used "ALLSELECTED ( PowerBI_Customer[Channel] ) )"

This will aways return the value compared with Channel. Is there a way to make this dynamic to the first row in the matrix? For instance, if I want to use the month to split rows instead of the channel? Or do I have to create as many new measue with all the possible combination?

Hi, @mciani 

Thank you for your feedback.

You can also try the below.

 

WA percentage V2 =
DIVIDE (
[TRADE SPEND],
CALCULATE ( [TRADE SPEND], ALLSELECTED ( PowerBI_Total_PL) )
)
Then, you can change the Channel column to the Month column, for instance.
 
However, I am not quite sure if it gives the correct answer for all situations. Because the measures that are related to [TRADE SPEND] have quite a lot of conditions. It is really hard to tell whether it will still show the correct result if ALLSELECTED is used with the main fact table.
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

THANK YOU!!!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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