?
Solved

Crystal report formula not working

Posted on 2014-01-01
8
Medium Priority
?
1,257 Views
Last Modified: 2014-01-01
I have one report where the following formula is not working. I did not design this reports and as far as I know the report should run and look for last months sales history data. Also I'm pretty sure this report worked in 2013 so it may be that the formula does not work in 2014 because of it set to look at last months data.

UPPERCASE(MONTHNAME(MONTH(CurrentDate)-1,FALSE))+" "+

TOTEXT(IF MONTH(CurrentDate)=1 THEN YEAR(CurrentDate)-1 ELSE YEAR(CurrentDate),0,"")

Open in new window


Here is the error I get
formula error
0
Comment
Question by:Gerhardpet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 11

Expert Comment

by:Gregory Miller
ID: 39749942
It is actually the Month formula not the Year...
Replace line 1 with this and see what happens:
IF MONTH(CurrentDate)=1 THEN UPPERCASE(MONTHNAME(MONTH(CurrentDate),FALSE)) ELSE UPPERCASE(MONTHNAME(MONTH(CurrentDate)-1,FALSE)) + " " +

Open in new window

0
 
LVL 42

Accepted Solution

by:
pcelba earned 2000 total points
ID: 39749972
Above formula returns JANUARY in January but it should return DECEMBER. This should fix it:
UPPERCASE(MONTHNAME(IF MONTH(CurrentDate)=1 THEN 12 ELSE MONTH(CurrentDate)-1,FALSE))+" "+

Open in new window

0
 
LVL 6

Expert Comment

by:ButlerTechnology
ID: 39749974
IF MONTH(CurrentDate)=1 
THEN UPPERCASE(MONTHNAME(12),FALSE)) 
ELSE UPPERCASE(MONTHNAME(MONTH(CurrentDate)-1,FALSE)) + " " +

Open in new window


I think you want to make a minor adjustment to Technodweeb's recommendation.

The issue is that the previous month concept of subtracting 1 works great until the you hit January as 1 - 1 = 0.  I hard coded the value for December in the true part of the If statement.
0
TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

 
LVL 11

Expert Comment

by:Gregory Miller
ID: 39749977
Yes, you are correct...
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39749985
@ButlerTechnology

You formula does it only replace the first line or the whole formula I have?
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 39749995
This is what I have now and I get this error
formula error
0
 
LVL 11

Expert Comment

by:Gregory Miller
ID: 39749996
Replaces only the first line...
as you have done

Remove the last ")" on the 3rd line
0
 
LVL 1

Author Closing Comment

by:Gerhardpet
ID: 39750099
@Technodweeb
That did not work.

@pcelba
your formula works. Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question