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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
UHS
Helper I
Helper I

Need help with relationship between two tables

Hi All,
I am having two tables between which there is no relation plus there is no unique key to identify unique records.
COls from table A to be used

Year-QuarterCost CentreOP_expense_Sub_catAmt_InQ_000s_Actual1Actual Allocation1Amt_InQ_000s_Budget1Budget Allocation1

COls from table B

FC_LOBCost CentreFunction codeAct SKF%

Final Expected result from both tables

Year-QuarterFC_LOBCost CentreFunction codeOP_expense_catOP_expense_Sub_catAmt_InQ_000s_Actual1Act SKF%Actual Allocation1Amt_InQ_000s_Budget1

Budget Allocation1

The cost centre in both the tables are not unique and for one costcentre there are multiple function codes. i want this func code col and act skf% to be in the table A
Both table have many to many relationship created and i have even added the cols from both the table in table visual. i am using related func and lokup func to add the table b col in table A but i get errorrs for multiple values are there where single value is expected.
How can i achieve this..
Appretiate quick help

1 ACCEPTED SOLUTION
UHS
Helper I
Helper I

Hi Everyone, 
Thanks so much for your replies.
I found the solution to my problem and here is what i did.
I created a bridge table between these two tables and added al lth eunique cost centres there and then indivisually joined tables by oneto many relationship as
Table A many to one relation with Bridge table and Table B many to one relation with Table A and make it active and also filter direction to be selected as both.
Then createe 2 measures in the table 2 where i wanted to have the logic updated
 Following all these steps my issue gor resolved.

View solution in original post

13 REPLIES 13
UHS
Helper I
Helper I

Hi Everyone, 
Thanks so much for your replies.
I found the solution to my problem and here is what i did.
I created a bridge table between these two tables and added al lth eunique cost centres there and then indivisually joined tables by oneto many relationship as
Table A many to one relation with Bridge table and Table B many to one relation with Table A and make it active and also filter direction to be selected as both.
Then createe 2 measures in the table 2 where i wanted to have the logic updated
 Following all these steps my issue gor resolved.

v-dineshya
Community Support
Community Support

Hi @UHS ,

Thanks for the update and happy to know you have found a solution. Mark it 'Accept as Solution'. It may help others who may be in similar scenarios.

 

Thank you.

ryan_mayu
Super User
Super User

@UHS 

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for yuor reply, my issue got resolved 

Hello Ryan,
thanks for your message. 
PFB data for reference

Table ATable BTable BTable BTable ATable ATable ATable B
Year-QuarterLBCCFCCatSubcatAmountAct%
2024-Q1NonCore1000000000-AA000CompensationBonus7.28499.6
2024-Q1NonCore1000000000-AA000CompensationOther Benefits13.705499.6
2024-Q1NonCore1000000000-AA000CompensationPension Expense5.7077699.6

2024-Q1

NonCore1000001111-AA1111Invest ExpInvest Exp-31.391260.4
2024-Q1NonCore1000001111-AA1111CompensationBonus7.2840.4
2024-Q1NonCore1000001111-AA1111CompensationOther Benefits13.70540.4
2024-Q1NonCore1000001111-AA1111CompensationPension Expense5.707760.4

 

I have highlighted the columns to identify which is coming from table A and B. Many to many relation is created between these two tables and this is what i see in my report visual right now.
Now i want to create two logics, i.e. if the cat is Invest Exp then Act% should be 100 else as it is and Fc should be AA1010 else as it is. so expected result should be as below :

How can i achieve it.
Note: @ different tables.. Joined based on mamuy to many relation

Table ATable BTable BTable BTable ATable ATable ATable B
Year-QuarterLBCCFCCatSubcatAmountAct%
2024-Q1NonCore1000000000-AA000CompensationBonus7.28499.6
2024-Q1NonCore1000000000-AA000CompensationOther Benefits13.705499.6
2024-Q1NonCore1000000000-AA000CompensationPension Expense5.7077699.6
2024-Q1NonCore1000001111-AA1010Invest ExpInvest Exp-31.39126100
2024-Q1NonCore1000001111-AA1111CompensationBonus7.2840.4
2024-Q1NonCore1000001111-AA1111CompensationOther Benefits13.70540.4
2024-Q1NonCore1000001111-AA1111CompensationPension Expense5.70776

0.4

Pls provide the sample data for table A and B separately.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for yuor reply, my issue got resolved.. i created a briddge table 

d_m_LNK
Responsive Resident
Responsive Resident

How are you trying to add the column?  Within a measure on the visual or with a calcualted column on the table?  The error you are getting is usually a context error where the function you wrote is expecting a single value (row context) but a column of multiple values is referenced instead of a single value.  

 

Could you paste the code of your measure/calculated column for us to better understand what's going on?

Hello,
PFB data for reference

Table ATable BTable BTable BTable ATable ATable ATable B
Year-QuarterLBCCFCCatSubcatAmountAct%
2024-Q1NonCore1000000000-AA000CompensationBonus7.28499.6
2024-Q1NonCore1000000000-AA000CompensationOther Benefits13.705499.6
2024-Q1NonCore1000000000-AA000CompensationPension Expense5.7077699.6

2024-Q1

NonCore1000001111-AA1111Invest ExpInvest Exp-31.391260.4
2024-Q1NonCore1000001111-AA1111CompensationBonus7.2840.4
2024-Q1NonCore1000001111-AA1111CompensationOther Benefits13.70540.4
2024-Q1NonCore1000001111-AA1111CompensationPension Expense5.707760.4

 

I have highlighted the columns to identify which is coming from table A and B. Many to many relation is created between these two tables and this is what i see in my report visual right now.
Now i want to create two logics, i.e. if the cat is Invest Exp then Act% should be 100 else as it is and Fc should be AA1010 else as it is. so expected result should be as below :

How can i achieve it.
Note: @ different tables.. Joined based on mamuy to many relation

Table ATable BTable BTable BTable ATable ATable ATable B
Year-QuarterLBCCFCCatSubcatAmountAct%
2024-Q1NonCore1000000000-AA000CompensationBonus7.28499.6
2024-Q1NonCore1000000000-AA000CompensationOther Benefits13.705499.6
2024-Q1NonCore1000000000-AA000CompensationPension Expense5.7077699.6
2024-Q1NonCore1000001111-AA1010Invest ExpInvest Exp-31.39126100
2024-Q1NonCore1000001111-AA1111CompensationBonus7.2840.4
2024-Q1NonCore1000001111-AA1111CompensationOther Benefits13.70540.4
2024-Q1NonCore1000001111-AA1111CompensationPension Expense5.70776

0.4

d_m_LNK
Responsive Resident
Responsive Resident

Thanks for the sample data, with which columns are you relating the tables?

Thanks for your reply, my issue got resolved by creating a bridge table.

v-dineshya
Community Support
Community Support

Hi @UHS ,

Thanks for the update and happy to know you have found a solution. You can simply post the details of your approach and mark it 'Accept as Solution'. It may help others who may be in similar scenarios.

 

Thank you.

Hi @UHS ,

 You can simply post the details of your approach and mark it 'Accept as Solution'. It may help others who may be in similar scenarios.

 

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.