Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to extract part of the string based based on a list of values?

pkmc
6 - Meteoroid

Hi everyone,
I am new to Alteryx and unable to figure this out

my data has the following line items for example:

expense Apr 21 - Jun 21
SO Jul 22 - Sep 22 expense

 

basically, expenses for the quarter where the period is mentioned in the description at varying character places.

 

i wish to extract the period mentioned which can start with any of the 12 months
I have defined a list of Months (Jan, Feb, Mar, .. Dec) but:

1. How do i do it?
2. If the list is used, while trying to search the month in the text, both start and end month of the quarter will be present in the list, how would that impact the output? 

9 REPLIES 9
ShankerV
17 - Castor

@pkmc 

 

If I understand your requirement, you need the output as Jul 22 - Sep 22

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @pkmc 

 

Proposing a simple solution

 

ShankerV_0-1669186790545.png

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @pkmc 

 

Step 1: Input

ShankerV_0-1669186889767.png

 

Step 2: Regex tool

 

ShankerV_1-1669186913808.png

 

Output after run:

 

ShankerV_2-1669186929760.png

 

Many thanks

Shanker V

 

 

ShankerV
17 - Castor

Hi @pkmc 

 

Kindly accept my solution if it resolved your show stopper.

 

Many thanks

Shanker V

pkmc
6 - Meteoroid

Hi thank you for your response!
Yes, i wish to extract the period

While i didn't understand the expression
looking at the output, it seems it is giving me the first 15 characters after the first whitespace

but the placement is not uniform across

so it could be as the following and keep on changing

entertainment expense Apr 21 - Jun 21
India high power SO Jul 22 - Sep 22 expense
ShankerV
17 - Castor

@pkmc

 

I posted the output for the input shared, if the huge dataset is not similar; please share more inputs from the huge dataset covering multiple scenarios.

 

Will share the best solution which will work even if there is many scenarios.

 

Many thanks

Shanker V

 

 

Christina_H
14 - Magnetar

If the format of the dates is consistent you could use this:

.*(\u{3}\s\d{2}\s-\s\u{3}\s\d{2}).*

Christina_H_0-1669217868310.png

pkmc
6 - Meteoroid

Hi @ShankarV

Really appreciate your efforts!

Sorry for not getting back, had moved on to other part of the workflow then.

Thank you so much! Christina's solutions worked in the given case.

Thank you again!

pkmc
6 - Meteoroid

Thank you so much Christina for your time and efforts, appreciate it!

Labels