cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Comparing 2 columns

HI,

 

I am comparing 2 columns and displaying the required text in the new column using the specs below.

 

  • IF Doc Type = Observation THEN “Audit Report without Observation”
  • IF Doc Type = Audit AND TRN ID is in  Parent ID Field THEN “Audit Report with Observation”
  • IF Doc Type =Audit AND  TRN is not in Parent ID Field THEN “Audit Report without Observation”
 
 
 
From the image below i need to check if 148833 is present in PARENT_ID and display "Audits with observation". 
The formula i used is: 
 
Counts = IF('Audit and Obs Data'[DOC_TYPE] = "Observation", "Audit without Observation", IF('Audit and Obs Data'[DOC_TYPE]="Audit" && CONTAINS('Audit and Obs Data','Audit and Obs Data'[TRN_ID],'Audit and Obs Data'[PARENT_ID]), "Audit","Audits without Observation"))
2019-12-04_13-57-08.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Comparing 2 columns

@kalyan209 you can containsrow function to find if TRN_ID exists in PARENT_ID or not

 

Is Parent Exists = 
CONTAINSROW( VALUES('Table'[Parent_Id] ), 'Table'[TRN_ID] )

 






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

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

3 REPLIES 3
Highlighted
Super User IV
Super User IV

Re: Comparing 2 columns

@kalyan209 you can containsrow function to find if TRN_ID exists in PARENT_ID or not

 

Is Parent Exists = 
CONTAINSROW( VALUES('Table'[Parent_Id] ), 'Table'[TRN_ID] )

 






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

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Highlighted
Super User IV
Super User IV

Re: Comparing 2 columns

@kalyan209 did you tried the formula? Put this new column in your table visual and you will find out if it is working or not.






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

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Highlighted
Frequent Visitor

Re: Comparing 2 columns

@parry2k it worked 

thanks for the formual 

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors