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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.