Jump to content

Date Calculation Using Case Function and Greater Than Not Working


This topic is 4100 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

)

Link to comment
Share on other sites

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
)

Link to comment
Share on other sites

This topic is 4100 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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