Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Reply
Highlighted
White Belt

Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Hello,

 

I have data that looks like this and the goal is to validate if the order season is in the selling season.  I tried like but it didn't seem to be consistent.   Any help would be appreciated.

Order SeasonSelling SeasonsGoal
18SP18SP,18SU,18FA,19SPY
19FA18SP,18SU,18FA,19SPN
18FA18SP,18SU,18FA,19SPY
20SP18SP,18SU,18FA,19SPN

 

Thank you,

 

DMJerry


Accepted Solutions
Highlighted
Purple Belt

Re: Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Do you have an example of your like statement or how it wasn't consistent?

 

Like should work to determine if the order season is in your selling season CSV string.

 

CASE
WHEN `Selling Seasons` like CONCAT('%', `Order Season`, '%') THEN
'Y'
ELSE
'N'
END


**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post


All Replies
Highlighted
Purple Belt

Re: Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Do you have an example of your like statement or how it wasn't consistent?

 

Like should work to determine if the order season is in your selling season CSV string.

 

CASE
WHEN `Selling Seasons` like CONCAT('%', `Order Season`, '%') THEN
'Y'
ELSE
'N'
END


**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post

White Belt

Re: Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Thank you!  The concat was the key that I missed.  Appreciate it sir!

Announcements
Win free lodging at Domoapalooza! We want you to share you favorite Domo tips and tricks. Click here for more details!