Alteryx Designer Desktop Discussions

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

Plugging in the revenue year based on transaction dates

SArielle
7 - Meteor

Hi All, 

 

I was wondering if anyone have any idea how to create a workflow for the following. 

 

Contract Start Date :  1 Apr 2022 to 31 Mar 2025

 

Transaction Date #1 :   15 Jan 2023, $50

Transaction Date #2 :   7 June 2023, $120

Transaction Date #3 :  1 Apr 2024, $500

 

Expected Outcome

 

 202220232024
Client 150120500
6 REPLIES 6
BRRLL99
11 - Bolide

Initial Target should be to extract Amount and Year

 

Step 1:

 

Add Formula tool and create 3 new columns

 

1 -    year : REGEX_Replace([Field1], '.*(\d{4}).*', '$1')

2 -     Amount - replace(REGEX_Replace([Field1], '.*(\$\d+).*', '$1'),'$','')

3 -   Client - 'Client 1'

 

Step : 2

 

Using Select tool, and remove Field1 column

 

Step 3 :

 

Use Cross Tab

Group By : Client column

Change column headers : Year

Values for new columns : Amount

Method : First

Yoshiro_Fujimori
15 - Aurora

Hi @SArielle ,

 

It may not be sophisticated, but if you want to get the fiscal year of each date, you may create a table of Date and Year, and then join it with the transactions.

 

Input

Contract Peiod

YearStartEnd
20222022-04-012023-03-31
20232023-04-012024-03-31
20242024-04-012025-03-31

 

Transactions

ClientDateAmount
Client 12023-01-1550
Client 12023-06-07120
Client 12024-04-01500

 

Output

Client202220232024
Client 150120500

 

Workflow

1277484_Workflow.png

SArielle
7 - Meteor

This is a great idea for single client but as different clients would have different contract start dates, creating a table with the year on the side might get very tedious. 

Qiu
21 - Polaris
21 - Polaris

@SArielle 
It will be better for you to share the complete sample input data (different clients would have different contract start dates😁

SArielle
7 - Meteor

Sure let me add on more samples just to illustrate my challenge. 

 

Contract Dates :

Client 1 : 1 Apr 2022 to 31 Mar 2025

Client 2 : 30 Nov 2021 to 31 Oct 2024

Client 3 : 1 May 2021 to 30 Apr 2023

Client 4 : 1 Jan 2024 to 31 Dec 2024

 

Transactions :

 

ClientTransaction DateAmounts
Client 115 Apr 202450
Client 21 Jan 202450
Client 41 Jan 202450
Client 315 Feb 2023100
Client 215 Feb 2022100
Client 415 Feb 2024100
Client 331 Oct 2022100
Client 230 June 2023100
Client 130 Mar 2023100

 

Expected Outcome

 

Client2021202220232024
Client 1 100 50
Client 2100 150 
Client 3 200  
Client 4   150
alexnajm
17 - Castor
17 - Castor

Workflow attached. There is no 2021 data in the above transactions, so this workflow does not have that column - if 2021 data is introduced, then it would automatically be included!

 

If you need to consider the contract dates in filtering out transactions, do so before the Crosstab tool! However, if the transaction occurs in reality, I would assume you'd want it included.

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels