4 Replies Latest reply on Feb 9, 2017 7:29 AM by Sharon Bailey

    Logic calculations not working for me

    Sharon Bailey

      I need to calculate full-time and part-time students, where the definition of full-time is different for undergraduates and graduate students. The columns I am working with are

      Career = undergraduate or graduate (a dimension)

      SCH Load 1 = credit hours taken face-to-face

      SCH Load 2 = credit hours taken online

      And I added a calculated Total SCH, which is Load 1+Load 2

       

      So I need to add Load 1 + Load 2, and if the student is undergrad and the total is >11, then the student is full-time. If the student is grad and the total is >8, the students is full-time. Otherwise, the students are part-time.

       

      I have tried many different calculations, and every time, I get all students returned as the "Else", whatever comes last. None of the students are matching my IF calculations.

       

      Here is what I have tried:

      IF ATTR([Career]="Undergraduate") AND SUM([CB SCH Load 1]+[CB SCH Load 2])<12 THEN "Part-time"

      ELSEIF ATTR([Career]="Graduate") AND SUM([CB SCH Load 1]+[CB SCH Load 2])<9 THEN "Part-time"

      ELSE "Full-time"

      END

       

      IF ATTR([Career])="Undergraduate" THEN (IF [Total SCH]>11 THEN "Full-time" end)

      ELSEIF ATTR([Career])="Graduate" THEN (IF [Total SCH]>8 THEN "Full-time" end)

      ELSE "Part-time"

      END

       

      IF [Career Parameter]="Undergraduate" AND SUM([CB SCH Load 1]+[CB SCH Load 2])<12

      THEN "Part-time"

      ELSEIF [Career Parameter]="Graduate" AND SUM([CB SCH Load 1]+[CB SCH Load 2])<9

      THEN "Part-time"

      ELSE "Full-time"

      END

       

      All these calculations are valid, but every record ends up the ELSE value.

       

      Thanks for any help you can offer!

      Sharon

        • 1. Re: Logic calculations not working for me
          Khang Pho

          Hi Sharon,

           

          I made some mock up data as follows (Note that I'm assuming each student would have its own row.  If you need to sum the SCH Load 1/2 over multiple rows then you need to do those aggregates).

           

           

          I used the following calc to get the desired effect.

           

          Status

          IF ([Career] = 'Undergraduate' AND ([SCH Load 1]+[SCH Load 2]) < 12) THEN 'Part-Time'

          ELSEIF

          ([Career] = 'Graduate' AND ([SCH Load 1]+[SCH Load 2]) < 9) THEN 'Part-Time'

          ELSE

          'Full-Time'

          END

           

          Please see attached workbook and I hope that helps.

           

          Regards,

           

          Khang

          • 2. Re: Logic calculations not working for me
            Sharon Bailey

            Thank you for the response. Your mock data is just like mine. I just tried it, and it returned all students as 'full-time', which is the final ELSE. That is the result I am getting every way I try it.

             

            I thought that the aggregation was the problem, that the computer was adding up columns of load before testing the conditions, but that doesn't seem to be the issue. First, if that was happening, all students would show as full-time, no matter what, but in my second calculation attempt, all the students were showing as part-time, which is the ELSE result.

             

            I also tried to calculate it with just Load 1, so that there would be no aggregation

             

            IF [Career]="Undergraduate" AND [CB SCH Load 1]<7

            THEN "Part-time"

            ELSEIF [Career]="Graduate" AND [CB SCH Load 1]<4

            THEN "Part-time"

            ELSE "Full-time"

            END

             

            Again, all students showed as full-time.

             

            This one worked:

            IF [CB SCH Load 1]<12 THEN "Part-time" ELSE "Full-time" END

             

            But if I add the career

            IF [Career]="undergraduate" AND [CB SCH Load 1]<12

            THEN "Part-time"

            ELSE "Full-time"

            END

             

            I expected that it would still work, but only undergrads would show, as if it had been filtered. Instead, both grads and undergrads showed, and all were full-time.

            • 3. Re: Logic calculations not working for me
              Khang Pho

              Hi Sharon,

               

              Is there anyway you can share some of your data?  I'm wondering if there are blanks or something causing it not to match.

               

              Khang

              • 4. Re: Logic calculations not working for me
                Sharon Bailey

                I have confidential information in the data set, so I will have to build a new workbook. Which I could, but I am going to try some workarounds first. I will come back to this eventually, because I know there has to be a way.

                Thanks for you help!

                Sharon