Solved

ms access transpose columns and values to rows

Posted on 2014-12-31
3
2,013 Views
Last Modified: 2014-12-31
Hello!

I have a query that has the following structure:
Date           Dim01   Dim02    Dim03    Dim04
12/31/14    0.123     1.234      0.567      2.987
01/05/15    0.126     1.287      0.611      2.888

Is it possible to make a crosstab query (or any type) to get an output like this?
Date           Dim        Value
12/31/14    Dim01    0.123
12/31/14    Dim02    1.234
12/31/14    Dim03    0.567
12/31/14    Dim04    2.987
01/05/15    Dim01    0.126
01/05/15    Dim02    1.287
01/05/15    Dim03    0.611
01/05/15    Dim04    2.888

The ultimate goal is to produce a report and graph that will show the variation for an individual Dimension over time.

Any and all help and suggestions are appreciated.  Thanks for your time and have a great new year!
0
Comment
Question by:jeff-h
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 500 total points
ID: 40525456
If your query looks like (which looks like a crosstab):

Date           Dim01   Dim02    Dim03    Dim04
12/31/14    0.123     1.234      0.567      2.987
01/05/15    0.126     1.287      0.611      2.888

What does the actual data already look like?  It would probably be easier to change the query you have than to "normalize" the crosstab query.  However, the technique for normalizing a non-normal table like this is a union query:

SELECT [yourDate], "Dim01" as Dimension, [Dim01] as DimValue FROM yourQuery
UNION ALL
SELECT [yourDate], "Dim02" as Dimension, [Dim02] as DimValue FROM yourQuery
UNION ALL
SELECT [yourDate], "Dim03" as Dimension, [Dim03] as DimValue FROM yourQuery
UNION ALL
SELECT [yourDate], "Dim04" as Dimension, [Dim04] as DimValue FROM yourQuery

BTW, [Date], [Dim], and [Value] are reserved words in Access, so if you want to use those as column headers, you will have to wrap them in brackets.  Personally, I prefer to change the column headers as I did above.
0
 

Author Closing Comment

by:jeff-h
ID: 40525507
Absolutely fantastic, thanks a million Dale!
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 40525581
glad I could help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question