Home > Basic Series, Tips and Tricks, Transformations > Transformation – Last Year

Transformation – Last Year

November 21st, 2008 Leave a comment Go to comments

Last Year Transformation:

SELECT DISTINCT
    y1.YEAR_ID          YEAR_ID
   ,(y1.YEAR_ID-1)   LAST_YEAR_ID
FROM LU_YEAR y1

The assumption is you would create this as a VIEW. Another option is, of course, to just add a column to your LU_YEAR table that’s the last (prior) year.  Something also to keep in mind…this Transformation only works if you’re dealing with data that is at the YEAR LEVEL already.  If you’re dealing with a Warehouse that compiles data at the monthly level, and you want the ability to actually compare month to month for prior year, it’s best to develop this at the bottom of the heirarchy, in the below case, it’s month.

 

MONTH_ID MONTH_DESC
200801 January-2008
200802 February-2008
200803 March-2008

SELECT DISTINCT
    m1.MONTH_ID              MONTH_ID
    ,(m1.MONTH_ID-100)   MONTH_PERIOD_ID
FROM LU_MONTH m1

  1. November 9th, 2009 at 19:09 | #1

    How are you? buy nolvadex low cost http://www.stumbleupon.com/stumbler/med-brother/ buy nolvadex drug You’re not in a hurry, are you?

    I would like to speak to you. buy mexican clenbuterol nolvadex online buy clenbuterol nolvadex online
    buy chemical citrate nolvadex research tamoxifen So long!

  1. No trackbacks yet.