Forum Discussion

Weav8060's avatar
Weav8060
Frequent Visitor
4 years ago

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

  • jppv20's avatar
    jppv20
    Icon for Solution Sage rankSolution 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
    • Weav8060's avatar
      Weav8060
      Frequent Visitor

      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... 🙂

      • jppv20's avatar
        jppv20
        Icon for Solution Sage rankSolution Sage

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

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    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