I have a simple IIF statement to say if the actual date is blank, show me TBC. Otherwise, show me what the actual date is. I can successfully get the TBC. But I cannot get the actual date to show where I know there is a date. Any help is appreciated.
=IIF(Fields!VPSR_Actual_Date.Value = "", "TBC", Fields!VPSR_Actual_Date.Value)
I'd do a check if the column is null or zero string and then format the date.
=IIF(IsNothing(CStr(Fields!VPSR_Actual_Date.Value)) OR CStr(Fields!VPSR_Actual_Date.Value) ="", "TBC", Format(Fields!VPSR_Actual_Date.Value, "dd-MMM-yyyy"))
Related
I am just trying to getting my data to do a color fill if the date value equals today.
The data is coming from oracle:
=IIf(Fields!finishDATE.Value = Today(),"Yellow","Transparent")
This will not give me any errors nor will it do the function according to the expression. None of the data with the finish date equaling today highlights.
If today is 8/24/2021 it should look like this:
3/22/2021, 8/24/2021, 2/22/2021
As I'm not sure what format the data will come in from Oracle (I'm a MS SQL person) then this might be overkill but try this
=IIF (Format(Fields!finishDATE.Value, "yyyyMMdd") = Format(Today(), "yyyyMMdd"), "Yellow", Nothing)
All I'm doing here is comparing just the date parts of the date/datetime values.
Below is the output. The first column is the actual date column contents including a time, then for illustration only, the 2nd column shows it formatted to just the date part and the 3rd column show today() with the same format applied.
Finally, I used the keyword Nothing (SSRS almost equivalent of NULL) as this is the correct default value.
I tried all kinds of variations of the following in my ssrs expression:
=iif(Fields!varchar.Value = "ABC20", Fields!StartDate.Value,Nothing)
It either yields the False clause, the first date field, or it shows as #Error when debugging.
The data type of StartDate is Date (Format= yyyy-mm-dd). Your help in resolving this is much appreciated.
Im trying to find the days gap between two dates using DateDiff function.
I have 2 datasets defined. If companycode is 'AB' then from one dataset else from another dataset I retrieve data.
Here is my expression. When I change to preview mode, it shows redmark to the first First(Fields!PeriodFrom.Value line. Why? (after generating report that field shows #Error
What Im doing wrong here?
=IIF(Parameters!CompanyCode.Value="AB",
DateDiff("d",First(Fields!PeriodFrom.Value, "ABReportData"), First(Fields!PeriodTo.Value, "ABReportData")),
DateDiff("d",First(Fields!PeriodFrom.Value, "XYReportData"), First(Fields!PeriodTo.Value, "XYReportData")))
I think there are two possible scenarios. First one is the expression
=First(Fields!PeriodFrom.Value, "ABReportData")
doesnt return a value. Add a column with this expression and check if you get a value.
If the value is correct, make sure that the DateDiff() function gets a date:
=IIF(Parameters!CompanyCode.Value="AB",
DateDiff("d",
CDate(First(Fields!PeriodFrom.Value, "ABReportData")),
CDate(First(Fields!PeriodTo.Value, "ABReportData"))
),
DateDiff("d",
CDate(First(Fields!PeriodFrom.Value, "XYReportData")),
CDate(First(Fields!PeriodTo.Value, "XYReportData"))
)
)
I have an access Table with a criteria that asks for a value:
[LAST CYCLE DATE YYMMDD]
I want to replace it with a calculated value for yesterday's date:
[LAST-PMT-DATE]=date()-1
this returns zero rows
but if I use [LAST-PMT-DATE]='180611' I get what I expect to see
What is the correct syntax my my calculated date?
Any help would be appreciated!
....further I tried this but get another error:
[LAST-PMT-DATE]=FORMAT(DATE()-1,"YYMMDD")
This is the solution:
[LAST-PMT-DATE]=FORMAT(DATE()-1,"YYMMDD")
The error I was getting, in my example, was the result of an extra ")", that was part of the full piece of code.
I am using SSAS cube to display data in my report. There is a date column in the cube which may be blank. If it is blank I need to display blank otherwise I need to format it as "MM-yyyy". I am using the below mentioned expression in the column.
=IIf(Trim(Fields!Chargeoff.Value) = "", "",
Format(CDate(Fields!Chargeoff.Value), "MM-yyyy"))
The rows which have date values are perfect with the correctly formatted date being displayed. However for blank rows, it displays error saying
The Value expression for the textrun ‘Chargeoff.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "" to type 'Date' is not valid
I tried with IsNothing, Null and everything else that came to my mind but could not get to display blank.
Does anyone have any suggestions on how to do this?
Update
I actually formatted my date in SSAS instead of SSRS.. That did the trick for me..
=IIF(CDATE(IIF(TRIM(Fields!RequiredStart.Value).ToString().Length = 0,
"1/1/0001",
Fields!RequiredStart.Value)).ToString() = CDATE("01/01/0001"),
"",
Format(CDATE(IIF(TRIM(Fields!RequiredStart.Value).ToString().Length = 0,
"1/1/0001",
Fields!RequiredStart.Value)), "dd-MMM-yyyy"))
:)
try putting and Empty Date in for the output instead of an empty string. 00-0000 it is looking for a Date and you give it an empty String. I would imagine that you either have to give it an empty date or a Default Date