This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
Hi, I am importing tables from SQL Server into Power Bi. Two tables, named TB and AP, have a 1-to-many relationship with a condition, ie:
TB.VLAS=AP.TPGE AND
CDA = '025' AND
NMF = 'AP' and NMC = 'TPGE'
What should I do to create this conditional relationship between the two tables? Can you please explain what to do? I am new to Power Bi, thank you!
General advice: Most tables/relationships in SQL Server are designed as a balance between input/update/selection. They are supposed to be normalised (supposed to be). Powerbi is a reporting system which is designed for reading of data. Use a star schema to optimise this and you transform the data in Power Query.
--
So the answer to your question may go away because you've changed the design. It is,generally, a mistake to import the tables from SQL Server as they are and try to recreate the relationships. In powerbi, you can't have multiple key relationships anyway.
@Anonymous Add calculated columns in both TB and AP tables to capture the condition for the relationship.
In the TB table, create a calculated column:
ConditionalKey_TB = IF(TB[CDA] = "025" && TB[NMF] = "AP" && TB[NMC] = "TPGE", TB[VLAS], BLANK())
In "AP" Table
ConditionalKey_AP = IF(AP[CDA] = "025" && AP[NMF] = "AP" && AP[NMC] = "TPGE", AP[TPGE], BLANK())
Once you have created these calculated columns, you can establish a relationship between the TB and AP tables based on these new columns.
Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.
i don't have a column in TB named CDA. I have this column only on AP and column NMC is only on TB table, not in AP table. So how i can edit your query? thank you
please, someone can help me?
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 21 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 58 | |
| 55 | |
| 42 | |
| 26 | |
| 24 |