Thank you for quick response, Sorry i can't load data, since its has some PHI, But in my query, I cross join with table 2 where I select MAX(RCM_PAY_STT_DT) and compare it that record is in current month or not, If its in current month I predict as 7 for my calculation, if the record is not in current month, then I put max_months. Like record one has max_month = 3 then I predict FORCASTED_MONTHS_MY = 7, record 2(a) and 2(b) has max_months = 2 and 1 then FORCASTED_MONTHS_MY = 2 and 5 since its total should be 7 (group by recordid). You understand what I mean.
... View more