5 Replies Latest reply on Feb 17, 2017 10:16 AM by Jim Dehner

    If statement and count

    antony runc

      Hello,

       

      What I need is to add up the internal and external cases i.e. 10 internal and 5 external, based on the below if statement and I just cant seem to get the statement right to get the desired results- any help would be much appreciated.

       

      If (case catergory) = 'colleague' Then 'internal'

      Else if (case category) = 'contractor' Then 'internal'

      Else if (case category) = 'first party' Then 'external'

      Else if (case category) = 'third party' Then 'external)

      Then Sum (case catergory)

      End

        • 1. Re: If statement and count
          chris monger

          Hi Antony,

           

          It depends on the setup of your data and how you want to display it.

          If your data is set up with case category as a dimension then you could just create groups for the internal/external, add them to an axis and run a count/sum of number of records.

           

          Alternatively if you remove the 'Then Sum (case catergory)' it will group into external and external and you can add it to the view.

          1 of 1 people found this helpful
          • 2. Re: If statement and count
            antony runc

            Thanks very much Chris - case category is a dimension so ill try create group option.

            • 3. Re: If statement and count
              Jim Dehner

              Hi Anthony

               

              Not certain what you are try to accomplish

              it looks like Case Category is a String field that you are putting into groups (note the dimension needs to be enclosed in [ ]  )

              but you last line is trying to do a sum - that won't work on a string - you  need to put anything that doesn't fall into one of the groups a group

                If you are trying to let everything else remain in its current category then the statement would be

               

              If [case catergory] = 'colleague' Then 'internal'

              Elseif [case category] = 'contractor' Then 'internal'

              Elseif [case category] = 'first party' Then 'external'

              Elseif [case category] = 'third party' Then 'external'

              else [case category]

              End

               

              Also you need to change Else If  to Elseif  

               

              Let me know if this helped

               

              Jim

              • 4. Re: If statement and count
                antony runc

                Great, thanks very much Jim for your reply - I've got the desired results from both yourself and Chris.

                 

                Have a great weekend

                 

                Ant

                • 5. Re: If statement and count
                  Jim Dehner

                  glad to be of some help

                  Jim