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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ermal
Frequent Visitor

Compare almost identical text values and expect a true/false result in a separate column.

Hi everyone,

 

Have been struggling for a while now. Hoping to find someone who can help.

I'm looking for a better formula to compare two text values of different datasets that are not identical, but similar.

So, as you can see below, I'm comparing data from Element A (dataset 1) with Element B (dataset 2) and hoping to get three times "True" as a value in a seperate column.

 

Ermal_0-1704214448310.png

 

Ermal_1-1704214501598.png

 

The formula that I'm currently using is:

 

" Column =

 

var sapNM = (trim(related('Dataset 1'[Element A])))

 

Return
CONTAINSSTRING(sapNM, (trim('Dataset 2'[ELEMENT B]))) "

 

When using this formula, I'm getting to many false values. I was thinking about turning the formula around but then I don't get the desired datasets anymore to choose from.

 

1 ACCEPTED SOLUTION

hi, @Ermal 

check below image 

Dangar332_0-1704273112530.png

 

blank value considerd as string so it give TRUE() as you face above 

try to replace blank() value with string that not present in comparision string .

 

View solution in original post

5 REPLIES 5
Ermal
Frequent Visitor

Hi Dangar,

 

Thank you for the formula.

Applied it and noticed some improvement on my report.

 

Still experiencing problems with the example below. Although there is so little difference, Power BI gives me false as a result when comparing these two values.

 

Ermal_0-1704221290410.png

 

Thanks for any contribution.

Ermal

Hi, @Ermal 

 

I think it happens because of dot(.) In element a 

 

For checking purpose 

Left(dataset [element a],len(dataset [element a])-1) 

 

Use above code for checking purpose it remove dot(.) From element a

 

After removing dot compare it with element b

 

If it gives true means dot (.) Create problem in above you mention 

Hi @Dangar332 ,

 

FYI
IF the dot(.) is in Element B and not in Element A then I'm not experiencing any issues, see below:

 

Ermal_0-1704223882801.png

 

If it is the other way arround, then it gives me false as a result:

 

Ermal_1-1704223971771.png

 

If Element A is an empty field compared to element B then it gives me True as a result:

 

Ermal_2-1704224111639.png

 

The other way around it gives me a false value

 

Ermal_3-1704224150157.png

 

I've been struggling with this for so long.
Perhaps I should settle for one good formula and accept that the system will never be able to accommodate everything.

hi, @Ermal 

check below image 

Dangar332_0-1704273112530.png

 

blank value considerd as string so it give TRUE() as you face above 

try to replace blank() value with string that not present in comparision string .

 

Dangar332
Super User
Super User

hi, @Ermal 

if  relationship present bw different table then try below for column

column =
   CALCULATE(
       CONTAINSSTRING(
           MIN('e 2'[element 2]),
           MIN('e 1'[element 1])
       )
   )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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