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
CG20
Regular Visitor

Need help in calculated column

Hi All,

I'm struggling with the calculations below is the data i.e. is Table1 & Table2, they have Many(Table1) to One(Table2) relationship.

CG20_1-1716200511378.png

 

 

I want that if ID & Country from Table1 has a matching record with the same ID & Country from Table2 then give me the Status column value for that matching record which would be TRUE/FALSE which I have deriverd.

 

I want help from you guys that for Non matching values(N) from Table1 with respect to Table2, Non matching Countries from Table1 should refer to the ALL value from Country column from Table2 & in the output we should get the Status column value of the ALL value of the Country column.

Inshort I want the values from STATUS column when ID&COUNTRY is matching we want STATUS of that particular ID&COUNTRY & for Nonmatching values it should refer to the Country = ALL & should return the Status value of the ALL value to all the nonmatching values of that particular ID

 

I'm trying to create a calculated column as: 

 

Check1 = IF(AND(Postgres[chain_id] = RELATED(Pheonix[ID]), Postgres[country] = RELATED(Pheonix[COUNTRY])), "Y", "N")
Check2 = IF(AND(Postgres[chain_id] = RELATED(Pheonix[ID]), Postgres[Check1] = "Y"), RELATED(Pheonix[Status]), "N")
 
Thanks for reading & helping me advance, eagerly waiting for the replies.

 

 

 

2 REPLIES 2
Arul
Super User
Super User

@CG20 ,

Which column serves as the relationship key between the tables? Neither the "country" column nor the "ID" column appears to satisfy a one-to-many relationship between the tables.





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

Proud to be a Super User!


LinkedIn


CG20
Regular Visitor

Hi Arul,

 

I had created a calculated column which contains concatenation of id&country in both the tables. When you create that you will see a Many(Table1) to One(Table2) relationship.

 

If you still have any doubts do reply on this post.

 

Thanks & Regards

CG20

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.