Query calculations when some records don't exist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doma23
    New Member
    • May 2010
    • 107

    #1

    Query calculations when some records don't exist

    Would it be possible later to do query calculations between two records even when one of the two records doesn't exist?

    Example:

    COMPANY____PERI OD___SALES

    Company1___1H20 12___125
    Company1___1H20 11___100
    *Company1___1H2 010____? (*this record doesn't exist at all)

    Company2___1H20 12___240
    Company2___1H20 11___220
    Company2___1H20 10___200


    So I want to compare these records, to see the percentage increase in Sales over three periods, for each company.

    I want to get something like this, period vs period comparison:

    COMPANY____1H20 11___1H2012
    Company1___ n/a ____ 25%
    Company2___ 10% ____ 20%
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You would do an aggregate query and pivot on the period. The missing value will be blank.

    Comment

    • doma23
      New Member
      • May 2010
      • 107

      #3
      How would I set up then the formula to show the percentage changes in the crosstab query (I suppose that's what you mean by pivot)?
      There would only be one field in which I must write formula, and that's Period (which would be shown as column), what do I write to compare different periods?

      Query view:


      Result:


      Edit: SOLVED
      I solved it by making another query and bringing Crosstab query to it, which then showed periods "1H11" and "1Q11" as Fields.
      It was quite simple after that.

      Comment

      Working...