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 moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
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?
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 26 | |
| 25 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 65 | |
| 35 | |
| 32 | |
| 25 | |
| 23 |