Hi Team
below is my data model
and based on that I need to create a table per below
username |
targetmonth |
sum(invoice_value) |
amount |
calculation |
A |
Oct |
76000 |
50000 |
|
A |
Nov |
100000 |
200000 |
|
A |
Dec |
76000 |
50000 |
|
Now I need the value in calculation column and the logic is
if(amount > sum(invoice_value), sum(unit*price),'NA')
now the thing is sum(unit*price) should only calculate unit and price when it start meeting the amount from the sale date , lets say user meet the amount target on 15th of dec than sum(unit*price ) should start after 15th not for all days.
for dec the total sum(unit*price ) is 7000 however after meeting the amount it should start after 15th dec and come to 4000
I am not sure if I was able to clear it out
Thanks