Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 20764

Default Date/Time Parameter Hide Time

$
0
0

I have 2 parameters of date/time type and need assistance displaying only the mm/dd/yyyy.

The first datetime parameter retrieves its value from another hidden datetime parameter. If the hidden parameter (called DefaultFrom) has no value or is null then the visible parameter is to display the first day of the year otherwise display the value of the hidden parameter but without the time portion showing.

My default expression is as follows:

=IIF(IsNothing(Parameters!DefaultFrom.Value),DateSerial(YEAR(Today()),1,1),Parameters!DefaultFrom.Value)

The above works ok when the hidden parameter has no value and it displays the first day of the current year. But when there is a value it is displaying it the full date and time. I have tried various 'Format" expressions in the above but end up with errors such as not returning expected type etc.

My second datetime parameter just defaults to the current date and time and i want to hide the time from the parameter display

Expression is currently as follows:

=DateValue(Now())

Because the two datetime parameters are used in a date range to locate records ideally I would like the first parameter above to always assume a 'midnight' time and the the 2nd parameter a '11:59:59' time so that when a user selects a From and To date range, all records that have their datepart fall between the two ranges will be returned.  Currently, for example, if a user selects a 'To' date of yesterday (4/1) the time will display the current hours/minutes. However if a record exists that was created on 4/1 at a later time it is not returned. 

Hoping this makes sense,


Robert


Viewing all articles
Browse latest Browse all 20764

Trending Articles