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
Weav8060
Frequent Visitor

comparing text values in two columns in current row

I can reference the current row value in columns [Col1] to [Col2] in a column calculation, such as 

  [CalcCol] = [Col1] = [Col2]

  [CalcCol] = [Col1] > [Col2]

 

It works for text too, but how can I perform such a simple parsing function such as:

  [CalcCol] = find( [Col1] , [Col2] )

 

Seems like nothing simple is available..?

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @Weav8060 

How do you compare two text column? 

Is your logic that 

[Col1] = [Col2]  then  [CalcCol] = [Col1] = [Col2]

[Col1] contain [Col2]  and [Col2] is less than [Col1]  then  [CalcCol] = [Col1] ?

I think you can share a sample and show me a screenshot with the result you want.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickl

jppv20
Solution Sage
Solution Sage

Hi @Weav8060 ,

 

I'm not sure if I understand the question completely, but this might work:

CalcCol = IF(CONTAINSSTRING('Table'[Col1],'Table'[Col2]),'Table'[Col2],BLANK())
 
Jori

thank you jppv20, CONTAINSSTRING() is the one, allowing references to current value in MORE THAN ONE column.  Neither FIND() nor SEARCH() allow this, nor does their documentation spell this out unequivocally.  I also note CONTAINSSTRING() is not included in this list Text functions (DAX) - DAX | Microsoft Docs .  I am still puzzled at DAX documentation... 🙂

@Weav8060 you are welcome! If my answer helped you could you please mark it as a solution?

 

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.