Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access transpose issue - task by due date

Posted on 2015-01-14
8
Medium Priority
?
182 Views
Last Modified: 2015-03-07
Hi,

I've got a fairly simple transpose issue that I can seem to figure out.  I found my old post completed by Capricorn1 and that did not solve my problem and I can't figure out what is wrong.

So I have data like this with say 4 Departments.
Due,Task,Dept,Completed
1/1/2015,Eat Lunch,A
1/1/2015,Eat Lunch,B,1/1/2015
1/1/2015,Eat Lunch,C
1/2/2015,Go Home,A
1/2/2015,Go Home,B,1/2/2015
1/2/2015,Go Home,C,1/2/2015
1/2/2015,Go Home,D,1/2/2015

What I need it to look like is:
Due              Task             A                B                   C                  D
1/1/2015  Eat Lunch                   1/1/2015                             N/A (no task for D)
1/2/2015  Go Home                    1/2/2015        1/2/2015    1/2/2015

From the transposed data, you can quickly see that Dept A has not completed either task, B is Ok, C has one task yet, and D only had one task as they didn't need to eat lunch for some reason (maybe the were fasting).

I spent probably more time that I should have trying figure this out.  Capricorn1 if you see this....  Others you may be able to help.
0
Comment
Question by:atljarman
[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
  • 4
  • 4
8 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 40549852
Not s0 elegant but try this:

Create a group by query like this, and name it "1":
SELECT YourTable.Due, YourTable.Task
FROM YourTable
GROUP BY YourTable.Due, YourTable.Task;

Create a Crosstab query like this and name it "2":
TRANSFORM First(YourTable.[Completed]) AS FirstOfCompleted
SELECT YourTable.[Due], First(YourTable.[Completed]) AS [Total Of Completed]
FROM YourTable
GROUP BY YourTable.[Due]
PIVOT YourTable.[Dept];

Create a third query, (joining the first two), like this, and name it "3"
SELECT [1].Due, [1].Task, [2].A, [2].B, [2].C, [2].D
FROM 1 INNER JOIN 2 ON [1].Due = [2].Due;

Now "3" should give you the output you specified...

sample attached:


JeffCoachman
Database51.mdb
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40549860
Like so
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40549885
Actually, ...you may not even need query "1" or "2", ...
...just make a query like this:

TRANSFORM First(YourTable.Completed) AS FirstOfCompleted
SELECT YourTable.Due, YourTable.Task
FROM YourTable
GROUP BY YourTable.Due, YourTable.Task
PIVOT YourTable.Dept;
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:atljarman
ID: 40549925
I will give this a try tonight and report back.
0
 

Author Comment

by:atljarman
ID: 40550454
Jeffery, your transform code works good.  Just not sure what to do as the one record that should show an N/A does not appear.  Is there a way to indicate that no record existed for that user.  It appears that the user has something that is required to be done.  So Eat Lunch for Dept D should show a value of N/A.  Is that possible?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40551422
This will be difficult as you structure does not define what a "missing" value should be,...
Further complicating this is that the Transform is a "summary", ...it cannot easily be made to show when a value might be missing form one of its components..

For example, if you have a sum of the 10 Sales you had in Spain.
You also have a sum of sales for USA, ...but USA only had 9 sales...
How is the summary to "know" that all sales sums require 10 values? (USA is missing a sale)

Now let's suppose that Germany had 11 sales...
Does this mean that Germany has "too many" sales (one extra or erroneous sale, ...or is it that both Spain and USA have "too Few"?

Finally, to me, ...a records with no completed date is "irrelevant" to the transform as well...
How can you have a record be considered in a summary when it is not finished yet, AFAIC, ...that record should not be considered, ...just as a "missing" record should not be considered...
So in the same way that these "incomplete" records are being created (and considered as part of he summary), ...then why cant the "D" create an incomplete record as well? (just as A, B, and C did?)
0
 

Author Comment

by:atljarman
ID: 40611529
I am still reviewing this response.  I actually have data now and diagnosing any issue
0
 

Author Closing Comment

by:atljarman
ID: 40651215
This was really helpful.  Sorry I am so late in responding.  I had to transfer live data to the application and test.  My work around for adding N/A was to concatenate responsibilities then to do a string comparison in the REPORT.  This was a HUGE pain because every time I opened the report it would run the script on every row to concat the responsibilities (not shown here).  The trick was to shut off that function while editing the other parts of the report.  I turned the concat function on and it worked like a charm.  

BTW... i'm not a fan of the way this report was written. I did create a filter so that the reports datasource could be changed.  I think that there would be much more valuable reports but had to meet the requirements on this one.  Thanks a million.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

670 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