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
TransactionID | CustomerID | TransactionType | Points | Balance |
1 | 1 | Credit | 3500 | 3500 |
2 | 1 | Debit | 200 | 3300 |
3 | 1 | Debit | 100 | 3200 |
4 | 1 | Debit | 400 | 2800 |
5 | 1 | Debit | 600 | 2200 |
6 | 1 | Credit | 200 | 2400 |
7 | 1 | Debit | 50 | 2350 |
Solved! Go to Solution.
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
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
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
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?
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).
Thank you soo much for the detailed solution
Have a good Day! 🙂
Stay Safe