×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Crystal formula to find the prior month end date from today

Crystal formula to find the prior month end date from today

Crystal formula to find the prior month end date from today

(OP)
What is the easiest way to write a formula to find the prior month end date?

I am trying to create a formula to find a "Fiscal year to date" when I am running the report in the middle of the next month.

So if I am running report on the 7/15 or 7/1, etc., I want the "Fiscal Year To date" to be 6/30

RE: Crystal formula to find the prior month end date from today

CODE

DECLARE @Dt datetime
SET @dt = '20190719'

SELECT DATEADD(dd, -DAY(@dt), @dt) 

Borislav Borissov
VFP9 SP2, SQL Server

RE: Crystal formula to find the prior month end date from today

When does your Fiscal Year start and end?
I deal with two of them at my place. One starts 7/1 and ends on 6/30, and another one starts on 10/1 and runs until 9/30
So depending on which FY I deal with, I either add 6 or 3 months to any date, and retrieve a Year from that calculated data. And I have a FY for that date.


---- Andy

There is a great need for a sarcasm font.

RE: Crystal formula to find the prior month end date from today

(OP)
My fiscal year ends 6/30 but what I am trying to do is just get the month end date for the last full month.

I want my info to be for the Fiscal Year to date for the date ending the last full month.

So if today is May 15, I want data from 7/1 to 4/30
or if today is June 2, I want data from 7/1 to 5/31.

I have a formula for the fiscal year start date, I need a formula for the date of the last day of the month for the previous month.

RE: Crystal formula to find the prior month end date from today

Did you try my example?

Borislav Borissov
VFP9 SP2, SQL Server

RE: Crystal formula to find the prior month end date from today

(OP)
I am looking for a crystal select formula, this appears to be a sql formula. How can I use this from within Crystal?

RE: Crystal formula to find the prior month end date from today

You've asked your question here, at forum183: Microsoft SQL Server: Programming, you've got the SQL Server answer.
Ask your question in one of the Crystal forums you belong to.


---- Andy

There is a great need for a sarcasm font.

RE: Crystal formula to find the prior month end date from today

(OP)
So Sorry! Thank you everyone for your help!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close