April 11, 2014 at 4:16 am
Hi,
I want my report to fetch data from Financial year starting to till date.
i.e Apr 2013 to till date.
till date means Today() minus 8 days and @Fromdate includes last week of march also
i.e Mar 29 2013 to Apr 4 2013 - this week data will also be included
So data from Mar 29 2013 - Apr 4 2013 to today() minus 8 days need to be displayed
How to fetch data for this.
Pls advise.The column corresponding to this looks like "2013-11-01 ~~ 2013 - 11- 07"
April 11, 2014 at 4:22 am
What all steps have you tried till now ? Where are you facing problem grouping it @ report level or @ Script level ?
April 11, 2014 at 4:33 am
I kept @odate as today() - 8days
and @Fromdate as "= Iif(Month(today())>04, "04/01/"&Year(Today()),Iif(Month(today())<= 04, "04/01/"&(Year(Today())-1),1))"
i wrote this query to fetch from april of last year.
i.e if i run today (year is 2014).It should automatically fetch from last year (april 2013)
i don't know how to proceed to for weekwise
April 11, 2014 at 4:51 am
With reporting requirements of this type, it's standard to use a Date Dimension.
This makes your code much less complex - and therefore more maintainable, it's orders of magnitude easier when reporting periods change (or even just the format of a reporting period description), you run one update against the values in the column rather than have to track down and update te complicated bits of code scattered through your codebase. It's also more efficient as you're simply adding a join rather than doing expensive calculations
I'm a DBA.
I'm not paid to solve problems. I'm paid to prevent them.
April 17, 2014 at 5:33 am
Thanks for ur reply.
But what update I should run and how to create dimension.
April 20, 2014 at 12:26 am
If you're using a normal database and not an SSAS cube, then you can use a Calendar table. Here's the article on it: http://www.sqlservercentral.com/articles/T-SQL/70482/
Basically, the Calendar table has a series of dates, and a bunch of other derived columns (hey, they're static data you can filter on!) you just join from your table to the date key in the Calendar table and then away you go!
April 20, 2014 at 9:03 pm
pietlinden (4/20/2014)
If you're using a normal database and not an SSAS cube, then you can use a Calendar table. Here's the article on it: http://www.sqlservercentral.com/articles/T-SQL/70482/Basically, the Calendar table has a series of dates, and a bunch of other derived columns (hey, they're static data you can filter on!) you just join from your table to the date key in the Calendar table and then away you go!
"It Depends". I find that some simple formulas are, many times, much faster, shorter, and easier to write than using Calendar Tables.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 21, 2014 at 9:02 am
My company does not use Date Dimension or Calendar tables, our solution to this kind of thing is similar to aar.mba.
select
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply