How to retrieve max date for To_Date parameter - ssrs-2008

I have one To_date parameter in my report, and I have to pass max date vale into the To_Date parameter from two data sets, which contains date. How can I write expression to retrieve max date?

you can try to use below expression
=IIF(MAX(Fields!PaymentDate.Value, "dsMain") > MAX(Fields!OrderCreatedDate.Value, "dsMain")
, MAX(Fields!PaymentDate.Value, "dsMain") , MAX(Fields!OrderCreatedDate.Value, "dsMain"))
Thanks.

Related

Crystal Reports: using date from the datatime field as a parameter

I am working on a report that I need to add a date range parameter. The field that I need to use in the datetime field, and I need to use the date portion from the field. I tried using the following, but the report returns no result.
cast(StartDateTime as date) between {?StartDate} and {?EndDate}
For the time being, I am using the Select Expert to sort the date range, but I have to manually enter the date in 'yyyy-mm-dd' format. Is there a way to set up the parameter, so that I can use the calendar to choose the dates?
I recommend to use one parameter field and set it to range and date instead of two.
With this you can use easily this formula:
{StartDateTime} = {?Parameter}
If you set the Parameter to Date instead of DateTime it will automatically check with the start of the day for the first range and the end of the day for the last range.

crystal reports function for calculating a value based on date range parameter

I need to calculate Sum of certain field value based on the date passed as parameter to the report.
I Need the following Calculations of value based on the date passed as parameter to the report:
Calculate the field value from 1st of the month to the date passed as Parameter.
Calculate the field value for the last month of the date passed as parameter.
Calculate the field value for the Previous day of the Date passed as parameter to the report.
Create a formula following this logic:
IF <Some Condition> Then Value ELSE 0
Then, simply SUM that formula.

compare extracted date with today() in excel

Column 1 : I have this date-time format in one column = 2018-10-08T04:30:23Z
Column 3 : I extracted date with formula = =LEFT(A11,10) and changed column format to date.
Column 32 : today(). Just to make sure both date columns match
Now when I want to compare both dates
Column 4 : =IF(C11=D11,TRUE(),FALSE())
It does not work. What did I do wrong?
One option using formulas only would be to use Excel's DATE function, which takes three parameters:
=DATE(YEAR, MONTH, DAY)
Use the following formula to extract a date from your timestamp:
=DATE(LEFT(A1,4), MID(A1,6,2), MID(A1,9,2))
This assumes that the timestamp is in cell A1, with the format in your question. Now, comparing this date value against TODAY() should work, if the original timestamp were also from today.
Should be worth trying:
=1*LEFT(A1,10)=TODAY()
May depend upon your configuration. Without format conversion (the 1*) you are trying to compare text (all string functions return Text) with a Number.

Custom date format iseries access odbc for SSRS

How to resolve my issue below?
1. I am pulling data from AS/400 DB2 using (iseries access odbc driver) to SSRS.
2. I want to format the column stores in integer to date format.
Sample = 20180612 below is the SQL Query.
Using below query,
SELECT CHAR(DATE(SUBSTR(DIGITS(20180612),1,4)||'-'||
SUBSTR(DIGITS(20180612),5,2)||'-'||
SUBSTR(DIGITS(20180612),7,2)),ISO) AS RESULTSDATE
Output = 2018-06-02
Question: How can I produce a below custom date format like d/m/yyyy
I have used, ISO, USA, LOCAL, JIS, EUR but no yield.
Example: 2/6/2018
If you want to do it in SQL Server, the closest you can CONVERT it to is the USA 110 (mm-dd-yyyy) in SQL Server.
If the your dataset has a field with the 2018-06-02, you can use the CDATE function is SSRS to convert it to a date and then format the text box the way you want with the FORMAT property or the FORMAT function.
Format Function:
=FORMAT(CDATE("2018-06-02"), "M/d/yyyy")
Format Property of Text Box:
/* this is as close as I can come to the desired results there is a leading zero */
select
varchar_format(
timestamp_format(char(20180612), 'YYYYMMDD')
, 'DD/MM/YYYY') as resultdate
from my8digitdatetable
/* for export IRL send out a date */
select
cast(
timestamp_format(char(20180612), 'YYYYMMDD')
as date) as resultdate
from my8digitdatetable
I got it already. I just format it to the date without formatting.
SELECT DATE(SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),1,4)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),5,2)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HREMCP.EMREDT)),7,2)) AS RESULTSDATE
After that, I put this as sub-query so that I can pass this to the parameter.
Below is my whole query, then at SSRS I can use date/time parameter control to compare with the results.
SELECT x.RESULTSDATE
FROM ( SELECT DATE(SUBSTR(DIGITS(MIN(DTAHRS.HRLVTP.LTLDTE)),1,4)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HRLVTP.LTLDTE)),5,2)||'-'||
SUBSTR(DIGITS(MIN(DTAHRS.HRLVTP.LTLDTE)),7,2)) AS RESULTSDATE
) as x
WHERE x.RESULTSDATE >= ? AND x.RESULTSDATE <= ?
I hope it will help you too.

Create a date in MDX (SSAS)

How it's possible to create a date in MDX for a given date ("4/6/2001 16:23:45").
Function now() returns the current date.
You can use the CDate function.