Results 1 to 6 of 6
  1. #1
    accessnewbie352 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    46

    Add New Field to Crosstab Query

    Hello - I am trying to add a new field to a crosstab query but when I pull the object down into the grid and click on "view spreadsheet" mode, it is not appearing.



    The crosstab query currently has different departments on top, and different businesses on the side. I am calculating percentages for each department-business in the query and they look to be working fine. However, I would like to add one more column to show overall total percentage by business (regardless of the department). The code I have so far:

    TRANSFORM Avg([2014 Rev].[Total%]) AS [AvgOfTotal%]
    SELECT [2014 Rev].SBU, Avg([2014 Rev].[Total%]) AS [Total Of Total%]
    FROM [2014 Rev] INNER JOIN [2014 Rev_Crosstab with Business %] ON [2014 Rev].SBU = [2014 Rev_Crosstab with Business %].SBU
    GROUP BY [2014 Rev].SBU
    PIVOT [2014 Rev].SummFunction;

    How do I display the calculated field for the final total business % (regardless of department - which is indicated by SBU)?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Did you try the CROSSTAB query wizard? It should automatically create a TOTALS field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    accessnewbie352 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    46
    Yes but the query automatically gives me what appears to be the total fields that calculates total by SBU and department. When I do the totals for only SBU in a separate query and then also in an excel file, I get different and higher values, so I believe the cross query is pulling in something additional to give the incorrect calculation.

  4. #4
    accessnewbie352 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    46
    i should add that i guess what I am trying to do is ultimately create a form with this crosstab query. I don't mind if I need to create a separate query for the totals (which I tried and the calculations look correct) but is there a way to create a form using values from 2 different queries? I have tried via the expression building and it keeps giving mes like [#TYPE] or [#ERROR]

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Why would you use a CROSSTAB on a form? Cannot edit the data.

    Queries can be joined just like tables can be joined.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    accessnewbie352 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    46
    I need to create a form to mirror something of a pivot table - I ended up creating the data I need in a query and then linking it to the crosstab and it is working now. Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 04-28-2014, 07:09 AM
  2. Calculated Field in Crosstab Query
    By bryan0 in forum Queries
    Replies: 2
    Last Post: 01-23-2014, 03:54 PM
  3. Replies: 9
    Last Post: 07-03-2013, 08:08 PM
  4. Replies: 1
    Last Post: 05-24-2012, 10:21 AM
  5. CrossTab - insert a calculated field
    By weiguo.shi in forum Queries
    Replies: 10
    Last Post: 05-23-2011, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums