Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Date Calculation Using Case Function and Greater Than Not Working

Featured Replies

I need to calulate the mileage costs based on various rates within ranges of dates.

For example, if the date of travel falls between July 1, 2012 and December 31, 2012 the travel cost value = .555, and if the travel date falls between January 1, 2013 and June 30, 2013 the travel cost value = .565

I have tried the following case function for the field <<mileage_cost>> with 2 records that contain the dates "12/12/2012" and 1/31/2013" respectively. The function returns the value ".555" for both cases, but should return ".565" for the second case.

Case(

travel_date > 6/30/2012; .555;

travel_date > 12/31/2012; .565

)

12/31/2012 is 12 divided by 31 then divided by 2012

 

The result is .000192394022959

 

You need to use the date function. 

Also, make sure your field travel_date is actually a date field.

 

Case(
travel_date > date( 6; 30;2012); .555;
travel_date > date(12;31;2012) ; .565
)

Actually, what you should do is avoid hard-coding data altogether. Instead, define a table of travel rates and lookup the appropriate mileage cost from there, using a relationship matching on date.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.