Alteryx Designer Desktop Discussions

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

Generate Random Transaction Date

tjamal1
8 - Asteroid

Hello, 

I have a table called Customer which contains customerID, I want to generate 1000 records transaction Data in this pattern

 

First Transaction every customer must be  credit Type

Then other transaction should be random  (either debit or credit) (depends on balance)

 

Credit means -> Add points

Debit means -> Deduct points from balance

Balance -> Points after every transaction 

 

Every Customer should contain -> 2 to 15 transactions

 

 

Here is the sample desired output for one customer 

 

TransactionIDCustomerIDTransactionTypePointsBalance
11Credit35003500
21Debit2003300
31Debit1003200
41Debit4002800
51Debit6002200
61Credit2002400
71Debit502350
6 REPLIES 6
RolandSchubert
16 - Nebula
16 - Nebula

Hi @tjamal1 ,

 

it should be possible to generate random tranaction data using the Generate Rows tool and Rand or RandInt function, to calculate balance, the Multi-Row Formula tool could be used. 

Could you be a bit more specific on "Then other transaction should be random  (either debit or credit) (depends on balance)" - is there a specific rule to select debit or credit as a transaction type?

 

Best,

 

Roland

tjamal1
8 - Asteroid

First transaction should be Credit 

 

 

The other transaction of customer could be random (credit or debit) based on these condition

 

If Balance less than 100 then Transaction should be credit else Debit  

RolandSchubert
16 - Nebula
16 - Nebula

Hi @tjamal1 ,

 

I attached a workflow to generate random transactions using Generate Rows tool and Multi-Row Formula tools. The share of Debit/Credit transactions may be influence by setting the value for Rand() in the Multi-row Formula tool calculationg the balance.

Let me know, if it works for you.

 

Best,

 

Roland

tjamal1
8 - Asteroid

Is there any way we can assign points in the multiples of 50

 

like 1050 , 4000, 1300   not like 1113 . 2386 

 

Also how can i add Transaction Date to every transaction for customer in a way that first transaction should be Today and other transaction should +1 with the previous transaction? 

RolandSchubert
16 - Nebula
16 - Nebula

Of course thre is a way. To get points as a multiple of 50, simply replace RandInt(n) by RandInt(n) * 50 (the MAX() formula is there to ensure, that no 0 values are generated). Transaction Dates can be added by using DateTime functions (DateTimeToday gives the current date, using DateTimeAdd a number of days can added).

tjamal1
8 - Asteroid

Thank you soo much for the detailed solution 

 

Have a good Day! 🙂

Stay Safe 

Labels