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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ChristophEmrich
Frequent Visitor

Divide values from different tables

Hi all,

 

I am trying to calculate the market share of certain products in a specfic country, in a specific year based on filtered values. For that I have two tables: Table_Sales and Table_Market and two slicers: Year and Country.

 

In the Table_Sales I have the list of products and their sales volumes in each country and each year:

YearCountryProductSales
2018FranceChocolate240
2018FranceStrawberry60
2018FranceVanilla168
2018GermanyChocolate100
2018GermanyStrawberry20
2018GermanyVanilla170
2018ItalyChocolate48
2018ItalyStrawberry32
2018ItalyVanilla56
2019FranceChocolate60
2019FranceStrawberry108
2019FranceVanilla168
2019GermanyChocolate12
2019GermanyStrawberry180
2019GermanyVanilla48
2019ItalyChocolate120
2019ItalyStrawberry60
2019ItalyVanilla160
2020FranceChocolate320
2020FranceStrawberry144
2020FranceVanilla48
2020GermanyChocolate150
2020GermanyStrawberry135
2020GermanyVanilla300
2020ItalyChocolate32
2020ItalyStrawberry56
2020ItalyVanilla152

 

In the Table_Market, I have the total market volume each year in each country:

YearCountryMarket Volume
2018Germany1,000
2018Italy800
2018France1,200
2019Germany1,200
2019Italy1,000
2019France1,200
2020Germany1,500
2020Italy800
2020France1,600

 

 

Now I somehow need to connect the tables and create a measure. I have a relationship on the key YEAR_COUNTRY but other than that, I don't know how to do it.

 

What I'd like to see is if in the slicers the selected values are "Select all", of course I'd like to see the market share of all products comined in all years and in all markets. If a year is selected, it should only be that year's market share.

 

I've tried a lot of stuff already, with SUMX, CALCULATE and others but nothing seems to work.

 

Hope I could make myself clear. Would appreciate any help! Thank you.

Christoph

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

I think you need two calculated tables and three measures.

 

Table 1: Calendar

 

Calendar =
DISTINCT ( UNION ( ALL ( Table_Market[Year] ), ALL ( Table_Sales[Year] ) ) )

Table 2: Countries

Countries =
DISTINCT (
    UNION ( ALL ( Table_Market[Country] ), ALL ( Table_Sales[Country] ) )
)

Relationships:

Countries[Country] -> Table_Market[Country]

Countries[Country] -> Table_Sales[Country]

Calendar[Year] -> Table_Market[Year]

Calendar[Year] -> Table_Sales[Year]

All relationships are one to many with cross-filtering as single.

 

Measure 1: MarketSize

MarketSize = SUMX(Table_Market,Table_Market[Market Volume])

Measure 2: SalesVolume

SalesVolume = SUMX(Table_Sales,Table_Sales[Sales])

Measure 3: MarketShare %

Market Share = DIVIDE(Table_Sales[SalesVolume],Table_Market[MarketSize],0)

For the slicers, use the Calendar[Year] and Countries[Country] fields.

 

MarketSize, SalesVolume, and MarketShare% will be correctly displayed.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,

I think you need two calculated tables and three measures.

 

Table 1: Calendar

 

Calendar =
DISTINCT ( UNION ( ALL ( Table_Market[Year] ), ALL ( Table_Sales[Year] ) ) )

Table 2: Countries

Countries =
DISTINCT (
    UNION ( ALL ( Table_Market[Country] ), ALL ( Table_Sales[Country] ) )
)

Relationships:

Countries[Country] -> Table_Market[Country]

Countries[Country] -> Table_Sales[Country]

Calendar[Year] -> Table_Market[Year]

Calendar[Year] -> Table_Sales[Year]

All relationships are one to many with cross-filtering as single.

 

Measure 1: MarketSize

MarketSize = SUMX(Table_Market,Table_Market[Market Volume])

Measure 2: SalesVolume

SalesVolume = SUMX(Table_Sales,Table_Sales[Sales])

Measure 3: MarketShare %

Market Share = DIVIDE(Table_Sales[SalesVolume],Table_Market[MarketSize],0)

For the slicers, use the Calendar[Year] and Countries[Country] fields.

 

MarketSize, SalesVolume, and MarketShare% will be correctly displayed.

Thank you, that did the trick!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.