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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Smile23
New Member

Related table

Hello i have a Problem with related Tables

 

I have a table a with

Product id

Manager id

Costs

 

And a table b with

Product id

Manager id

And a percentage split.

 

In other words, if there is a value in table b, the costs (table a) should be divided by the percentage key (table b) - which also changes the manager of table a to that of table b (One manager ID then becomes two). If there is no entry for a project, the costs and the manager ID from table A remain

 

Do you please give me an idea of ​​what a solution could look like? Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Smile23 ,

 

I created some data:

TableA:

vyangliumsft_0-1699926686700.png

TableB:

vyangliumsft_1-1699926686701.png

 

 

Here are the steps you can follow:

1. Create calculated column.

 

Step1 =
var _TableBProduct=
SELECTCOLUMNS(
    'TableB',"Product",'TableB'[Poduct id])
return
IF(
    'TableA'[Poduct id] in _TableBProduct,
    'TableA'[Costs] *
    SUMX(
        FILTER(ALL('TableB'),
        'TableB'[Poduct id]=EARLIER('TableA'[Poduct id])),[Percentage split]),
        'TableA'[Costs])
Step2 =
var _TableBProduct=
SELECTCOLUMNS(
    'TableB',"Product",'TableB'[Poduct id])
return
IF(
    'TableA'[Poduct id] in _TableBProduct,
    MAXX(
        FILTER(ALL('TableB'),
        'TableB'[Poduct id]=EARLIER('TableA'[Poduct id])),'TableB'[Manage id]),'TableA'[Manage id])

 

 2. Result:

vyangliumsft_2-1699926752593.png

 

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Smile23 ,

 

I created some data:

TableA:

vyangliumsft_0-1699926686700.png

TableB:

vyangliumsft_1-1699926686701.png

 

 

Here are the steps you can follow:

1. Create calculated column.

 

Step1 =
var _TableBProduct=
SELECTCOLUMNS(
    'TableB',"Product",'TableB'[Poduct id])
return
IF(
    'TableA'[Poduct id] in _TableBProduct,
    'TableA'[Costs] *
    SUMX(
        FILTER(ALL('TableB'),
        'TableB'[Poduct id]=EARLIER('TableA'[Poduct id])),[Percentage split]),
        'TableA'[Costs])
Step2 =
var _TableBProduct=
SELECTCOLUMNS(
    'TableB',"Product",'TableB'[Poduct id])
return
IF(
    'TableA'[Poduct id] in _TableBProduct,
    MAXX(
        FILTER(ALL('TableB'),
        'TableB'[Poduct id]=EARLIER('TableA'[Poduct id])),'TableB'[Manage id]),'TableA'[Manage id])

 

 2. Result:

vyangliumsft_2-1699926752593.png

 

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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