ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

LEFT, RIGHT FUNCTION

DataAnalyst
メテオール

Hello, I have 2 columns with qtrs formatted as Q2/15 and so on.

 

My calculation for deliquent quarters will look at both these quarter fields. Since i cant subract in this format, I used the LEFT function to extract the year values from both the fields which works fine.

 

However, when i use the right function to get say the value 2 in Q2/2015, i get all 0s. Is there a regular expression i can use or try something else. I just need number 2 from Q2/2015.  I have tried trim function as well.

 

Thanks!

 

 

11件の返信11
BenMoss
ACE Emeritus
ACE Emeritus

Could you please post your desired output and data and perhaps we could offer more hands on help then :)

MarqueeCrew
20 - Arcturus
20 - Arcturus
Substring([field],1,1)

That will get you '2'


If you want the number 2,

ToNumber(Substring([field],1,1))
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
steffimerlin
アトム

Hi,

 

I would like to get some more clarity on how the RIGHT and LEFT function works in Alteryx since I don't have the software to try it out myself.

 

if for example consider the below phrase -

Water and Ice

 

Could someone please explain to me what would the output be for RIGHT([string],7) and LEFT([string],7) :

 

Does the RIGHT and LEFT function count spaces and punctuation as well? And is it 0 based? 

 

Thanks,
Steffi

 

 

 

ChrisTX
16 - Nebula
16 - Nebula

See this documentation page for all functions: https://help.alteryx.com/current/Reference/Functions.htm

 

neilgallen
クエーサー

To specifically answer the question, 

 

RIght would output "and Ice"

 

while

 

Left would output "Water a"

 

it does count spaces and punctuation, and lastly, directly from the documentation:

 

"About Length and Strings: When referencing the LENGTH of a string the first character is counted as 1 (the length of the following string "record" is 6). HOWEVER, when referencing the character position within a STRING, positions are actually counted BETWEEN characters. So think of the first character's position as 0.  Therefore, the position of the letter "c" in the string "record" is at position 2."

steffimerlin
アトム

Thank you so much. That really helped! 

TS4
メテオロイド

Thanks for mentioning that the count starts at 0.  First time I used substring, and I could not figure out what was going on!

Idyllic_Data_Geek
アステロイド

I will like to retain the right 5 digits from a number. For example , from 0123456789..I will like to keep 56789

Luke_C
17 - Castor
17 - Castor

@Idyllic_Data_Geek, if it's stored as a numeric field, you'd have to do Right(ToString([FIELD]),5)

ラベル
トップのソリューション投稿者