4 Replies Latest reply on Apr 7, 2017 12:33 PM by kazznfx

    Can you help fix a calculation?

    akowitz

      I'm trying to create a calculation field that puts a number 1 in the field, if the attendance rate is 90% or higher.  If it's less than 90%, it needs to be a 0, and blank if there's no attendance rate calculated so far.  Been trying the "Case" and "If" functions and can't seem to get it right.  Seems like FM doesn't like the ≥ or ≤ signs.  So then I tried to show is as >= and that didn't work either.  Here's some of the attempts:

       

      • If(FY17 CurrentYearUnExcAttendanceRate   ≥ "90.00%"; "1"; If(FY17 CurrentYearUnExcAttendanceRate   ≤ "89.99%"; "0"))
      • If(FY17 CurrentYearUnExcAttendanceRate  > "89.99%"; "1"; If(FY17 CurrentYearUnExcAttendanceRate < "90.00%"; "0"))
      • Case (Met Objective   = "1"  and FY16 CurrentYearUnExcAttendanceRate   ≥ 90 ; 0 ; Met Objective  ≠   "1" and FY16 CurrentYearUnExcAttendanceRate  ≤ 89.99; 0 ; FY16 CurrentYearUnExcAttendanceRate )
      • Case( Met Objective   = "1"  and FY16 CurrentYearUnExcAttendanceRate   ≥ 90 ; 0)
      • Case( Met Objective   = "1"  and FY16 CurrentYearUnExcAttendanceRate   >= 90 ; 0)

       

      Can someone help?  Thank you!

        • 1. Re: Can you help fix a calculation?
          philmodjunk

          Get rid of the quotes around your numbers. Write your percentages as decimals. Write 90% as 0.9 For example.

           

          Writing your calculation with either form of inequality operator should work once you fix the notation errors.

          • 2. Re: Can you help fix a calculation?
            kazznfx

            Hey There,

             

            I think some of your case statements are close, but I think what's causing the problem is that you're checking if there is a value of "99.00%."

             

            While that might be what you see as the end user, usually FM just sees that value as an integer or even a decimal depending upon your design.

             

            Have you tried something like this?

             

            Case (

                 Isempty ( FY16 CurrentYearUnExcAttendanceRate) ; "" ;      // if no value set field to empty string ""

                 FY16 CurrentYearUnExcAttendanceRate > = .9 ; 1 ;           // if greater than 90%

                 0                                               // default result, if neither of above match, default value is 0

                     )

            • 3. Re: Can you help fix a calculation?
              akowitz

              Thank you!  I based on your recommendations, I changed it and it worked!

               

              Case (FY16 CurrentYearUnExcAttendanceRate >= .9; 1; 0)

              • 4. Re: Can you help fix a calculation?
                kazznfx

                Awesome!

                 

                If you still want to empty the field when there's no attendance rate calculated so far, you'll wanna add that to your Case().