I have a huge volume of a history of transactions table with acc_nbr, tran_nbr, tran_amt, tran_dt, and tran_dis tran_prd
I need to find the first date for each acc_nbr and tran_prd
Find the First date When the account with this type of product purchase it with a discount
Lets say we have the below input table for the same account number :
tran_dt | acc_nbr | tran_prd | tran_amt | tran_dis |
---|---|---|---|---|
1-1-2020 | 666 | A | 777 | 0 |
3-4-2020 | 666 | A | 777 | 0 |
5-5-2021 | 666 | C | 222 | 18 |
7-1-2022 | 666 | A | 777 | 20 |
3-5-2023 | 666 | A | 777 | 99 |
And i want the output be :
acc_nbr | tran_prd | Effective dis date | tran_amt (sum) | tran_dis sum |
---|---|---|---|---|
666 | A | 7-1-2022 | 1,554 | 119 |
666 | C | 5-5-2021 | 222 | 18 |