Alteryx Designer Desktop Discussions

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

Output with multiple conditions

lumjingbki
8 - Asteroid

Can someone please help to get the below output with the given conditions

 

Start MonthEnd MonthStart YearEnd YearPeriodConditions
JanJan20232023Janif the month and year are same then "Start Month"
FebMar20232023Feb - Marif the months are different but the years are same then "Period" = Feb - Mar
MarMar20232024Mar 2023 -Mar 2024if the months are same but the years are different then "Period" = Mar 2023 -Mar 2024
JanFeb20232024Jan 2023 - Feb 2024if the months are different and the years are also different then "Period" = Jan 2023 - Feb 2024
3 REPLIES 3
ShankerV
17 - Castor

 @lumjingbki 

 

One way of doing this.

 

ShankerV_0-1687248871731.png

 

ShankerV
17 - Castor

Hi @lumjingbki 

 

Step 1: Input

 

ShankerV_0-1687248921353.png

 

 

Step 2:

ShankerV_1-1687248948884.png

 

ShankerV_2-1687248967597.png

 

 

Step 3: 

 

ShankerV_3-1687248986975.png

 

IF [Start Year]=[End Year] AND [Start Month]=[End Month]
THEN [Start Month]
ELSEIF [Start Year]=[End Year] AND [Start Month]!=[End Month]
THEN [Start Month]+" - "+[End Month]
ELSEIF [Start Year]!=[End Year] AND [Start Month]=[End Month]
THEN [Start Month]+" "+[Start Year]+" - "+[End Month]+" "+[End Year]
ELSEIF [Start Year]!=[End Year] AND [Start Month]!=[End Month]
THEN [Start Month]+" "+[Start Year]+" - "+[End Month]+" "+[End Year]
ELSE ""
ENDIF

 

 

ShankerV_4-1687249010876.png

 

Many thanks

Shanker V

Qiu
21 - Polaris
21 - Polaris

@lumjingbki 
Maybe you can try with the Formula tool with IF Then conditional statement?

Labels