Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
Hope you are doing well,
i want to calculate a cumulative score i have in my input :
ID CLIENT | PURCHASE AMOUNT EN MAD | |
A | 90 | 0 |
B | 120 | 2 |
C | 160 | 2 |
B | 300 | 8 |
C | 290 | 6 |
A | 310 | 8 |
and the seconde table score :
AMOUNT | SCORE |
100 | 2 |
200 | 6 |
300 | 8 |
i want in my output with a tmap something like this :
ID CLIENT | SCORE |
A | 8 |
B | 10 |
C | 8 |
thx you for your help
Hi @manodwhb ,
the first table contain two columns the idclient and the amount. and the seconde table contain the amount and the score so the relation between them maybe the amount . by joining with a condition on the amount
here is all topic :
INTRO
A company X has implemented a new CRM module to build customer loyalty.
INPUT
On the one hand, X has an e-commerce site that manages all purchase transactions.
attached is an example of an extract file from their e-commerce site.
LOOKUP
In addition, attached is the scoring table that allows you to assign a score to each transaction rounded down to the nearest unit.
For example:
80 MAD equals 0 points
100 MAD equals 2 points
140 MAD equals 2 points
200 MAD equals 6 points...
BUSINESS RULES
The score is calculated for each separate transaction, and then cumulated per user:
Example
Transaction 1 of client A: 99 MAD -> Score 0
Transaction 2 of client A: 99 MAD -> Score 0
Transaction 3 of client A: 120 MAD -> Score 2
---> Total score of client A: 2 points.
The score grid is provided just as an example, only the format of the score file is important. The job should therefore be generic and treat the score file as input.
OUTPUT
The expected output is a list of the different customers with their cumulative scores.
thx you for your reply.
i wan to do it with a tmap .
it's not just a cumulative score, but also it's about the condition on the join with row1.amount=row2.amount to get the right score for each client before i cumul.
i did a unique match to get the last row with the condition : row1.amount>=row2.amount but it's not working for me .