March 14, 2018 at 6:24 am
Hello,
I need to display sales report in following pattern
Category Feb Jan Dec Total
Fabric 200 200 300 700
NonFabric 100 200 400 700
Total 300 400 700 1400
I need to display Last three month sales report along with the total.
Kindly help me to build logic for the same.
Regards
Shirish Phadnis
March 14, 2018 at 6:37 am
WHERE [SaleDate]>DATEADD("m",-3,GETDATE()) ?
https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql
March 14, 2018 at 11:26 pm
Thank you for reply.
But I need to display month name dynamically.
It should be last 3 months from current month
Please advise.
March 15, 2018 at 7:26 am
shirish1987 - Wednesday, March 14, 2018 11:26 PMThank you for reply.
But I need to display month name dynamically.
It should be last 3 months from current month
Please advise.
How are you planning to display the information? In an SSRS report? If you try to name the columns dynamically, SSRS won't be able to use the query after a month, as the column names would have changed. If it's always going to be a manual query, then dynamic column names would be okay. Indicate which scenario you need and someone can do a much better job of helping you.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
March 16, 2018 at 1:17 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply