Populate new record data based on previous month record data

  • yingchai (2/8/2012)


    Hi JonFox,

    I had tried execute your sql in my fact table which contains 123591 records.

    The performance is quite good actually...took around 2 seconds to complete...but the results seems not quite right as it only returns 72854 rows...I was expecting more than 123591 rows being returned.

    I will update my findings to you later.

    Thanks.

    Hi JonFox,

    I managed to found out why there are some results discrepancy. If my source data contains the below scenario, it does not bring the prior month forward.

    ('CMP1000', 'PM1',2011,11,100),

    ('CMP1001', 'PM1',2011,11,101),

    ('CMP1002', 'PM1',2011,11,102),

    ('CMP1003', 'PM1',2011,11,103),

    ('CMP1000', 'PM1',2011,12,0),

    ('CMP1001', 'PM1',2011,12,111),

    ('CMP1002', 'PM1',2011,12,112),

    ('CMP1003', 'PM1',2011,12,113),

    ('CMP1000', 'PM1',2012,01,0),

    ('CMP1001', 'PM1',2012,01,0),

    ('CMP1002', 'PM1',2012,01,122),

    ('CMP1003', 'PM1',2012,01,123)

    But there is a possibility that my fact table contains this kind of data. How can I bring the prior month data forward from the above scenario? Kindly advise.

    Thanks/.

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply