Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext 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
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
Solved! Go to Solution.
Hi @Smile23 ,
I created some data:
TableA:
TableB:
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:
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
Hi @Smile23 ,
I created some data:
TableA:
TableB:
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:
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 68 | |
| 33 | |
| 33 | |
| 31 |