2021年1月22日星期五

Count number of years since last deduction

I have a table similar to below where the same account has its fiscal years (FY) and deductions for each year broken out in multiple rows. Accounts can range from 1 - 20+ years. How do I group to one unique row that shows the current year and how many years its been since the account had a deduction?

from this:

enter image description here

to this:

enter image description here

Started to utilize the CTE approach as I have in the past, but as before it started to get ugly and I know there has to be a simpler approach...

https://stackoverflow.com/questions/65854751/count-number-of-years-since-last-deduction January 23, 2021 at 09:04AM

没有评论:

发表评论