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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jimrob
Frequent Visitor

Combining weights from two tables to calculate a weighted percentage to show in a stacked bar chart

Hi!

Sorry if this is already answered somewhere, I couldn't find it or didn't know what to search for.
I would like to aggregate data from one table using weights from another table in order to show the overall exposure. Below I have provided an example:


I am looking to acheive this desired result (manually created in excel to demonstrate):

jimrob_2-1656495832815.png

I have two tables - one of Portfolios, which each hold mulitple securities, with Weights that sum to 100 for each Portfolio. And one of Securities, which each have one or more geographical exposures, which sum to 100. (In Power BI I have created a many to many relationship between the tables by Security ID.)

 

A table of portfolios with the weight of each security:

 

Portfolio IDSecurity IDWeight
123456Fund A20%
123456Fund B40%
123456Fund C40%
987654Fund A10%
987654Fund C50%
987654Fund D40%

 

A table of securities with the weight of each geography:

 

Security IDGeographyWeight
Fund AUSA50%
Fund AEurope20%
Fund AUK10%
Fund AAsia20%
Fund BUSA90%
Fund BUK10%
Fund CEurope80%
Fund CUK20%
Fund DAsia100%

 

What type of relationship or measure or changes to the way the data is stored do I need in order to achieve the above?

Thanks in advance!

 

2 REPLIES 2
amitchandak
Super User
Super User

@jimrob , Merge these in power query and multiple their Weight and create a new column 

 

Merge: https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Thanks @amitchandak !

 

I presume you mean a new column for each geography? Unfortunately in the real data that would be many many columns.

 

I was hoping there is a way to establish the relationship more dynamically.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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