Sum Daily Data Into Weekly Data

  • Hi

    This is how my Table Looks like with 3 weeks of data on daily basis for two CP Codes:

    I have data for 30 such Codes.

    CP CodeDateTotal Pageviews

    510142010-06-272623221

    510142010-06-281985718

    510142010-06-291815712

    510142010-06-302126104

    510142010-07-011702672

    510142010-07-021666468

    510142010-07-032019123

    510142010-07-041783373

    510142010-07-051890672

    510142010-07-062424314

    510142010-07-072197743

    510142010-07-082097884

    510142010-07-092029226

    510142010-07-101989296

    510142010-07-111833109

    510142010-07-122398424

    510142010-07-132365550

    510142010-07-141810926

    510142010-07-152483211

    510142010-07-162327007

    510142010-07-171758154

    530372010-06-276059

    530372010-06-286310

    530372010-06-296394

    530372010-06-304627

    530372010-07-013402

    530372010-07-023115

    530372010-07-033032

    530372010-07-042995

    530372010-07-053122

    530372010-07-073040

    530372010-07-083638

    530372010-07-093767

    530372010-07-103745

    530372010-07-113576

    530372010-07-123860

    530372010-07-133123

    530372010-07-143458

    530372010-07-153516

    530372010-07-163233

    530372010-07-173176

    After converting this data into Weekly basis, it looks like this:

    Its actually a view that I created from daily data.

    CP CodeWeekStartDateTotal Pageviews

    510142010-06-2713939018

    510142010-07-0414412508

    510142010-07-1114976381

    530372010-06-2732939

    530372010-07-0420307

    530372010-07-1123942

    "Total Pageviews" is the aggregate for each week.

    I have created two more views from same same table. They have same CP Code Column in them. Is there any Solution to this as I'm using this for report builder and having no PK in any of the views doesnt give the desired results.

    Thanks

  • Novicejatt (7/26/2010)


    Hi

    This is how my Table Looks like with 3 weeks of data on daily basis for two CP Codes:

    I have data for 30 such Codes.

    CP CodeDateTotal Pageviews

    510142010-06-272623221

    510142010-06-281985718

    510142010-06-291815712

    510142010-06-302126104

    510142010-07-011702672

    510142010-07-021666468

    510142010-07-032019123

    510142010-07-041783373

    510142010-07-051890672

    510142010-07-062424314

    510142010-07-072197743

    510142010-07-082097884

    510142010-07-092029226

    510142010-07-101989296

    510142010-07-111833109

    510142010-07-122398424

    510142010-07-132365550

    510142010-07-141810926

    510142010-07-152483211

    510142010-07-162327007

    510142010-07-171758154

    530372010-06-276059

    530372010-06-286310

    530372010-06-296394

    530372010-06-304627

    530372010-07-013402

    530372010-07-023115

    530372010-07-033032

    530372010-07-042995

    530372010-07-053122

    530372010-07-073040

    530372010-07-083638

    530372010-07-093767

    530372010-07-103745

    530372010-07-113576

    530372010-07-123860

    530372010-07-133123

    530372010-07-143458

    530372010-07-153516

    530372010-07-163233

    530372010-07-173176

    After converting this data into Weekly basis, it looks like this:

    Its actually a view that I created from daily data.

    CP CodeWeekStartDateTotal Pageviews

    510142010-06-2713939018

    510142010-07-0414412508

    510142010-07-1114976381

    530372010-06-2732939

    530372010-07-0420307

    530372010-07-1123942

    "Total Pageviews" is the aggregate for each week.

    I have created two more views from same same table. They have same CP Code Column in them. Is there any Solution to this as I'm using this for report builder and having no PK in any of the views doesnt give the desired results.

    Thanks

    If you were to convert that to "readily consumable data" according to the article at the first link in my signature line below, I'll bet someone would jump on this problem for you... might even be me. 🙂

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi

    Thanks Jeff. Ill post it in usable form.:-)

Viewing 3 posts - 16 through 17 (of 17 total)

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