Different color on crosstab report - crystal-reports

I want to make a field a certain color based on the difference between its transaction date and today.
I'm using the formula
IF DateDiff ('D',{Command.DATE_RECEIVED},CurrentDateTime)>=6
THEN CRRED
ELSE IF DateDiff ('D',{Command.DATE_RECEIVED},CurrentDateTime)<6
THEN CRYELLOW
ELSE IF DateDiff ('D',{Command.DATE_RECEIVED},CurrentDateTime)<3
THEN CRGREEN
But everything show's red, even for items received today.

Related

border color change on weekends and bank holidays in Crystal Reports calendar

I'm writing a report in Crystal Reports where it basically shows an annual calendar of all the different types of absences employees might have had during the year, though my client said he wants to see the weekends marked differently.
I have tried using a formula on the borders this way:
IF DayOfWeek (CurrentDate) = 7 or DayOfWeek (CurrentDate) = 1 then crRed
else crNoColor
No error is given, but nothing is presented in red on the report once I generate it when its Saturday or Sunday.
Am I going the right way?

Using dateadd with specific conditions

So I have two different date fields in my report. One is command.install date and the other is command.mfgdate. My problem is for some records mfgdate is blank and others installdate is blank and sometimes both dates exist in a record. I’m trying to use a formula with dateadd to return a replacement date based on a predetermined number of years. What I would like to do is use a formula that would first use mfgdate then use installdate as a “safety net” if mfgdate happens to be blank. Is there anyway that this is possible?
If a date shows "blank" inside the report, it usually means the date is NULL.
Therefore, the following formula should give you the desired result:
If Not IsNull({command.mfgdate}) Then
{command.mfgdate}
Else If Not IsNull({command.installdate}) Then
{command.installdate}
Else
// backup-date if both dates are NULL
CDate(1900,1,1)

Error while putting select expert condition

NEED SOME HELP WITH CRYSTAL REPORT. I was able to use the formula in select exert in one of my reports but the same formula is not working in another report.
All the fields are available in the new report also but it gives me an error " The formula cannot be used because it must be evaluated later".
My goal is just to make sure that the input date range is not more than 32 days. If there is another way to achieve please guide me.
Can anyone please help me.
The formula is
{#date difference} <= 32 and
currentdate - {#Start Date} <=60 and
{Command.DATE_TRANSACTION} = {?Date}
More details :
#date is my parameter.
#start date is formula minimum(#dtransate)
#End date is formula maximum(#transdate)
#date difference is formula DateDiff("d",{#Start Date} , {#End Date})+1
Move the condition from Record Selection Formula to Group Selection Formula.
Totals are not available to Record Selection Formula because it evaluates before totals are evaluated.
It worked by making two parameters as start date & end date in the record selection formula:
{Command.DATE_TRANSACTION} >= {?Start_Date}
{Command.DATE_TRANSACTION} <= {?End_Date}

Tableau: Conditional Formatting Rows based on a data range

Any help you can provide would be appreciated. I can't find any tableau tutorials that deal with conditional formatting based on dates. Plenty of formatting based on cell values, but that doesn't help in this case.
I am trying to create a tableau report that shows the change records that are due within the below criteria and color code the rows accordingly.
The next seven days represented by "red"
The next 14 days represented by "yellow"
Greater than 14 days out represented by "green"
Everything else would have a white background
Something I did that sounds similar was around due dates:
Create a calculated field called "Due Date Traffic Lights" to work out your days amount. The below gives the date difference between the given date field and today:
DATEDIFF('day',MAX([Due Date]), MAX(TODAY()))
Create calculated field "if" function called "Due Date Range" to categrorise these results:
if [Due Date Traffic Lights] < -7 THEN "GREEN: Over One Week Left"
ELSEIF [Due Date Traffic Lights] > -7 AND [Due Date Traffic Lights] <0
THEN "ORANGE: Due in one Week"
ELSE "RED: Overdue"
END
So on your rows you can then drag the "Due Date Range" into your "Color Icon" and set the color for each of the 3.

SSRS background color expression based by date value

Here is my issue, I have a table in SSRS that I've created that has a due date field (RegulatoryDateDecisionDue). Based on that date field, I need to change the colors of the rows if today's date is past the due date the field should be red. If the amount of hours are less than or equal to 72 hours from today's date till the due date (basically like a countdown till it's due), the rows should be orange, else rows should be white.
Here is the expression I wrote, but I am having an issue, I get error, and idea what I am doing wrong or if I should be doing this differently? Any and all help appreciated.
=IIF((now() > Fields!RegulatoryDateDecisionDue.Value), "Red", IIF(((DateDiff(DateInterval.Hour, Fields!RegulatoryDateDecisionDue.Value, Now()) <= "72"), "Orange", "White")))
Try:
=Switch(
DateDiff(DateInterval.Hour, Fields!RegulatoryDateDecisionDue.Value, Now())<=72,"Orange",
Fields!RegulatoryDateDecisionDue.Value<now(),"Red",
true,"White"
)
It is better use Switch for multiple conditions.
Let me know if this helps.
Some things to try :
Use a switch instead of iif to have a better reading
use "h" insted of DateInterval.Hour
write 72 instead of "72"