Creating an aging report
i need create report looks in report builder (not excel, example).
https://www.dropbox.com/s/84cey7rkpknq3li/example.jpg
i know need use dateadd function, maybe in combination iff, haven't slightest how it.
ipainter
********
update. again, got flagged abusive! not trying abusive. trying learn sql experts.
hello,
your sql should
declare @inputdate date ='2013-03-11'
select
customer_name,
convert(date,cast(invoice_date varchar(20))) invoicedate,
invoice,
invoiced_amount,
due_date,
case when convert(date,cast(due_date, varchar(20))) < (@inputdate) (invoiced - paid) else 0 end past_due
,case when datediff(d,convert(date,cast(a.epdudt varchar(20))),@inputdate) between -999 , 0 (invoiced - paid) else 0 end current_
,case when datediff(d,convert(date,cast(due_date varchar(20))),@inputdate) between -7 , 0 (invoiced - paid) else 0 end past_due1_7
,case when datediff(d,convert(date,cast(a.epdudt varchar(20))),@inputdate) between -14 , -8 then (invoiced - paid) else 0 end past_due8_14
,case when datediff(d,convert(date,cast(a.epdudt varchar(20))),@inputdate) between -21 , -15 (invoiced - paid) else 0 end past_due15_21
,case when datediff(d,convert(date,cast(a.epdudt varchar(20))),@inputdate) between -28 , -22 (invoiced - paid) else 0 end past_due22_28
,(invoiced - paid) amount_owed
from table1 .. etc
hope helps!
please mark answer if answers question.
sary awwad
SQL Server > SQL Server Reporting Services, Power View
Comments
Post a Comment