Forum Discussion
Anonymous
2 years agoNot applicable
conditional relationship
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 = '...
fahadqadir3
2 years agoSolution Supplier
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.
Anonymous
2 years agoNot applicable
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
- Anonymous2 years agoNot applicable
please, someone can help me?