• Arrange data for chart (2000)

    Author
    Topic
    #408768

    I have a table which contains fields ItemID and W1,W2,W3,W4….upto W53 – these fields are used to store values for week 1 to week 53 during a year.
    I need to produce a graph which displays w1 to w53 as the series.
    How can I rearrange the data so that i get a query which holds the data as:
    itemid w1
    itemid w2
    itemid w3
    etc

    to allow me to then use this query data as the chart series……or is there another way around this?
    John

    Viewing 3 reply threads
    Author
    Replies
    • #866008

      You can download a sample database from Roger’s Access Library (thanks to Support4John for this tip) that demonstrates how to normalize and denormalize tables.

      You can also take a look at post 229516. It contains a code example for a similar situation.

    • #866009

      You can download a sample database from Roger’s Access Library (thanks to Support4John for this tip) that demonstrates how to normalize and denormalize tables.

      You can also take a look at post 229516. It contains a code example for a similar situation.

    • #866012

      The simpler approach would be to modify your design and set up and populate your your table as follows:

      ItemID, Week Number, Value

      Then all you would need to do in the query is group by Item and Week Number

      With your current design, what happens when the weeks span multiple years? The setup you have is wasting a lot of table space. You may also run into query problems if you have many null values in data that is not populated.

      If you really do not want to change your table design, you could in code loop through the weeks to extract data by week and use an append query to append the data to a new table in the format needed. (Too much work.)

      Just my 2cents

      • #866020

        Thank you both for your input.
        I realised that the table wasn’t ideal – an inherited design – but didn’t want to have to rearrange the data. Part of the reason for not redesigning was not being able to think of an easy way to automatically rearrange the table.
        Thanks to both of you I now have a method of rearranging and creating the chart.
        Thanks as always

      • #866021

        Thank you both for your input.
        I realised that the table wasn’t ideal – an inherited design – but didn’t want to have to rearrange the data. Part of the reason for not redesigning was not being able to think of an easy way to automatically rearrange the table.
        Thanks to both of you I now have a method of rearranging and creating the chart.
        Thanks as always

    • #866013

      The simpler approach would be to modify your design and set up and populate your your table as follows:

      ItemID, Week Number, Value

      Then all you would need to do in the query is group by Item and Week Number

      With your current design, what happens when the weeks span multiple years? The setup you have is wasting a lot of table space. You may also run into query problems if you have many null values in data that is not populated.

      If you really do not want to change your table design, you could in code loop through the weeks to extract data by week and use an append query to append the data to a new table in the format needed. (Too much work.)

      Just my 2cents

    Viewing 3 reply threads
    Reply To: Arrange data for chart (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: