...
c) as of 2010-01-01, what were the repayments on active loans that loan officer XXX dealt with. Here's where I struggle a bit. It's a little struggle technically but really its a bigger struggle to make sure you are asking the right question. The query below only looks at non-adjusted repayments for active loans managed by a loan office at a certain point in time... which is okay if that's what the question really wasis.
Panel |
---|
select ifnull(sum(principal_amount),0.0) as principal_paid, ifnull(sum(interest_amount),0.0) as interest_paid from fact_loan_repayments paid where p.personnel_id = 'XXX' and dpaid.action_date _value <= date('2010-01-01') and l.loan_status in ('AccountState-ActiveInGoodStanding', 'AccountState-ActiveInBadStanding') |