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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need something like lookup or DAX

Hi,

I have two columns, ColumnA and ColumnB having the below records

 

Actual Data

Column 1Column 2
DanDan
RogerJeff
EugilineMax
SamuelRoger
PeterEugiline

 

I want to compare Above two columns and display result as shown below in powerBi using formula

Result
Jeff
Max

 

Result
Samuel
Peter

 

Thanks,

Ravi

1 ACCEPTED SOLUTION

Hi @Anonymous,

Please create calculated columns using the following formulas and get expected result shown in screenshot.

Column3 = IF(Test[Column 1]=Test[Column 2],BLANK(),Test[Column 1])

Column4 = IF(Test[Column 1]=Test[Column 2],BLANK(),Test[Column 2])

1.PNG

 

Best Regards,
Angelia

View solution in original post

7 REPLIES 7
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

>>I want to compare Above two columns and display result as shown below in powerBi using formula

How to compare the two columns? I am unable to reproduce based on your given sample data. Maybe some values are missing out in your given example.


 I post the solution based on my understanding for your requriement.

Type the example data table to PowerBI.

Capture11.PNG

Please click Nwer Table under Modeling on home page. type the following formula, you will get the two expected table.

 

Tab1 = SELECTCOLUMNS(FILTER('Actual Table',OR('Actual Table'[Column 2]="Jeff",'Actual Table'[Column 2]="Max")),"Result",'Actual Table'[Column 2])

Capture14.PNG

Tab2 = SELECTCOLUMNS(FILTER('Actual Table',OR('Actual Table'[Column 1]="Samuel",'Actual Table'[Column 1]="Peter")),"Result",'Actual Table'[Column 1])

 

Capture15.PNG


If this is not what you want, please share more details for further analysis.

Best Regards,
Angelia

Anonymous
Not applicable

Hi Angelia,

I am looking for more of dynamic approach, I have two columns as below, First I have to compare records of column1 with column2 and display the non-matching records(samuel ,peter) in a new column(say column3), similarly comapre records of column2 with column1 and display the non-matching records(Jeff,max) in another column(say column4).

 

Actual

Column 1

Column 2
DanDan
RogerRoger
EugilineEugiline
SamuelJeff
PeterMax

 

Thanks,

Ravi

Hi @Anonymous,

Please create calculated columns using the following formulas and get expected result shown in screenshot.

Column3 = IF(Test[Column 1]=Test[Column 2],BLANK(),Test[Column 1])

Column4 = IF(Test[Column 1]=Test[Column 2],BLANK(),Test[Column 2])

1.PNG

 

Best Regards,
Angelia

Anonymous
Not applicable

Thanks Angelia, it works:)

 

Regards,

Ravi

@Anonymous

Just so we are clear, the end result you are looking for is something like "IF the name from column 2 is found in column 1, then 0 else 1" to create a flag that you could use to bubble up the names that exist in column 2 that do not exist in column 1? That way you could use the flag as a slicer to show names.

Does that sound about right?

Not saying that is a calculation, just asking if that is what you are looking to do.

@v-huizhn-msftdoes that seem to be ther request?





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

Proud to be a Super User!




Anonymous
Not applicable

Yes thats correct, I wanna comapre the records in column1 and column2, and display the the names that exist in column 2 that do not exist in column 1 and vice versa.

Hi @Anonymous,

If you have resolve your issue, please mark right reply as answer, which will help more people.

Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.