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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
NewUser3300
Frequent Visitor

Data modeling for a relationship between products and city

Hello there, I´ve been struggling with this issue.

I have a table of products with a base price, but the price changes based on the city its sold (distribution fee). 

 

IdProductPrice
1Product 120.00
2Product 230.00
3Product 325.00

 

 And I have another table like this.

IdCityProductDistribution Fee
1New yorkProduct 11.2
2ChicagoProduct 11.3
3DenverProduct 21.0
4WashingtonProduct 20.5

 

What i want to archive in Power Bi is something like this:

CityProduct 1Product 2
New York21.2 
Chicago21.3 
Denver 31.00
Washington 30.50

 

I want to sum (price + distribution fee) according to the city  is sold. But I'm not sure how to link the tables, or which measure should I use. Can someone help me?

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

hello @NewUser3300 

 

please check if this accomodate your need.

1. create a relationship many-to-many

Irwan_0-1740528721763.png

2. create a new measure with following DAX

Total Sum = 
SUMX(
    FILTER(
        'Distribution',
        'Distribution'[Product]=SELECTEDVALUE('Price'[Product])
    ),
    SELECTEDVALUE('Price'[Price])+'Distribution'[Distribution Fee]
)
3. plot into matrix visual
Irwan_1-1740528767659.png

 

Hope this will help.

Thank you.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Assuming there will never be a repetition in the Product column 1 of Table 1 AND there is a relationship (Many to One and Single) from Table 2 to Table1, write these calculated column formulas in Table2

DF = related('Table1'[Price])

Total = [Distribution fee]={df]

Create a matrix visual and write this measure

Measure = sum([Total])

Hope this helps.


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

I actually used your anwser to solve the problem, thank you

You are welcome.


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

hello @NewUser3300 

 

please check if this accomodate your need.

1. create a relationship many-to-many

Irwan_0-1740528721763.png

2. create a new measure with following DAX

Total Sum = 
SUMX(
    FILTER(
        'Distribution',
        'Distribution'[Product]=SELECTEDVALUE('Price'[Product])
    ),
    SELECTEDVALUE('Price'[Price])+'Distribution'[Distribution Fee]
)
3. plot into matrix visual
Irwan_1-1740528767659.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors