Link to home
Start Free TrialLog in
Avatar of atljarman
atljarman

asked on

Access transpose issue - task by due date

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.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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;
Avatar of atljarman
atljarman

ASKER

I will give this a try tonight and report back.
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?
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?)
I am still reviewing this response.  I actually have data now and diagnosing any issue
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.