Results 1 to 3 of 3
  1. #1
    svobfamily is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2017
    Posts
    3

    Need to calc Min in crosstab query with Zero field

    I have a cross tab query with scores in rows that may contain 0 based on a Null value. I used Null: IIf(Sum([Score]) Is Null,0,Sum([Score])) to convert the Null to 0

    When I add a Min to the query, it leaves out the 0 scores and just returns the lowest non-0 number as the Min. I think this is because the Null is not part of the Total Score calc?



    The idea is to drop the lowest score from a series of matches (which would include a zero score).Click image for larger version. 

Name:	crosstab.JPG 
Views:	9 
Size:	30.0 KB 
ID:	27593

    TRANSFORM IIf(Sum([Score]) Is Null,0,Sum([Score])) AS [Null]
    SELECT AR_Sporter_Panhandle_Best.[Display Name], AR_Sporter_Panhandle_Best.Team, AR_Sporter_Panhandle_Best.[Skill Level], Sum(AR_Sporter_Panhandle_Best.Score) AS [Total Of Score]
    FROM AR_Sporter_Panhandle_Best
    GROUP BY AR_Sporter_Panhandle_Best.[Display Name], AR_Sporter_Panhandle_Best.Team, AR_Sporter_Panhandle_Best.[Skill Level]
    PIVOT AR_Sporter_Panhandle_Best.Hometown;

    Is there a way to do this? Right now I have to export the crosstab to excel, add Min column and then import it back in for a report.

    thankyou!!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you didnt need the IIF,
    a NZ(field) will convert.

  3. #3
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    in addition to 256's input; consider performing your 0 conversion and your other data calculations in the normalized data before cross tab. Cross tab is presentation/display and the last step of a process typically.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-12-2015, 10:48 AM
  2. Add New Field to Crosstab Query
    By accessnewbie352 in forum Queries
    Replies: 5
    Last Post: 01-03-2015, 10:48 PM
  3. calc field producing unwanted spaces amidst the final string
    By kattatonic1 in forum Database Design
    Replies: 7
    Last Post: 07-12-2013, 10:32 AM
  4. Update calc field after context Filter
    By bhammer in forum Forms
    Replies: 12
    Last Post: 11-05-2012, 02:16 PM
  5. calc field
    By nashr1928 in forum Forms
    Replies: 8
    Last Post: 11-09-2011, 09:21 PM

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