9 Replies Latest reply: Aug 23, 2017 4:02 AM by Hans de Vries RSS

    How do I count the # of records within a group?

    Hans de Vries

      Morning everyone!

       

      Please take a look at this table:

         

      NumberTotal
      7642510000000
      76425--
      76425--
      511185000000
      51118--
      428892500000
      462232500000
      3899910000000
      38999--
      38999

      --

       

       

      It's a bit of a strange table: some numbers have a total, some don't (NULL). Now, what I want is to substract a certain amount from the total in the first record (which has a total) DEPENDING on the number of records within the Group (Group by Number).

       

      If there are 3 records, I need to substract 7,500,000, when there are 2 I need to substract 5,000,000 and when there is 1 record, I don't need to do anything.

       

      How is this accomplished?

       

      Any help is greatly appreciated!!