Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Unable to run this code

terrellchong
8 - Asteroid

Hi, I cannot run this code on filter, is there anything I type wrong?

 

[F1] = IF [Current Month]<4 THEN "Q1" ELSEIF [Current Month]<7 and [Current Month]>3 THEN "Q2" ELSEif [Current Month]<10 and [Current Month]>6 THEN "Q3" ELSE "Q4" ENDIF

 

8 REPLIES 8
grazitti_sapna
17 - Castor

Hi @terrellchong  the reason why this code is working seems to be like you are using a wrong tool, try using formula tool as mentioned ni the screenshot. Then use filter tool to filter Q1,Q2,Q3,Q4.

I hope this helps.

Thanks.

 

grazitti_sapna_0-1593768149596.png

 

Sapna Gupta
terrellchong
8 - Asteroid

Hi Graziti, good to hear from you again.

 

The reason that I want to use it in filter is because I want the sheet to be smart enough to choose the necessary criteria for a report. (for example, when it was January, it will automatically choose Q1 so on and so forth.

 

I tried to add tostring() in front of it but it wasnt working too.

 

Is there any tool that you would recommend me to use for my type of cases?

 

 

grazitti_sapna
17 - Castor

@terrellchong , will it be possible for you to share a sample workflow along with the output so that I can look into it?

Thanks.

Sapna Gupta
terrellchong
8 - Asteroid

Yes, here you go.

terrellchong
8 - Asteroid

@grazitti_sapna Sorry the output will be looking like this

F1Current Month
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
Q25
grazitti_sapna
17 - Castor

Hi @terrellchong ,I guess this is what you are looking for.

 

Try using this formula in filter as per the output you mentioned.

 

IF [Current Month]<4 THEN F1="Q1" ELSEIF [Current Month]<7 and [Current Month]>3 THEN F1="Q2" ELSEif [Current Month]<10 and [Current Month]>6 THEN F1="Q3" ELSE F1="Q4" ENDIF

 

grazitti_sapna_0-1593770032328.png

 

Sapna Gupta
terrellchong
8 - Asteroid

Thank you once again ya!

grazitti_sapna
17 - Castor

Welcome!

Sapna Gupta
Labels