Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Date Parameter default issue in Report Builder

New to paginated reporting. 

 

I am trying to connect to an existing dataset with calendar table. I have used the Date field( date data type)from calendar as a filter and trying to use the  parameter.

I tried to default the date to today's date in the report parameter by using TODAY(). That generated error as datatype mismatch. 

How can i set the date  with default as today's date in paramter? 

 

 

 

8 Replies

  • In the "General" tab for the parameter did you make sure to set the data type of the parameter to datetime ?

    • Anonymous's avatar
      Anonymous
      Not applicable

      d_gosbell 

       

      Yes. Data type is set to datetime.  My date field in calendar is set as the date as the dataset is used in many other reports and i cannot change that. 

      My requirement is

      1. Allow the selection of any date - I am able to do that 

      2. Default is to be set to today - Having trouble in setting Today() in default expression as error says type mismatch. I tried setting as text, but did not get default value 

       

  • At what point does this error appear? I use default of TODAY() or TODAY()-1 in lots of our reports and it works fine although usually I wrap it in CDATE() to strip off the time portion. 

     

    Does the report work if you pick a different date? If not this would suggest that the issue is with the parameter in your query, not with the default value.

    • Anonymous's avatar
      Anonymous
      Not applicable

      d_gosbell 

       

      Here is what i did. 

      My query generated is below  based on my dataset.

       

      EVALUATE SUMMARIZECOLUMNS('OrderHeader'[Customer PO],
      'OrderHeader'[Order Number],
      'OrderHeader'[Order Date],
      RSCustomDaxFilter(@OrderHeaderOrderDate,EqualToCondition,[OrderHeader].[Order Date],DateTime))

       

      I tried to add the Default value in Report Parameter 

      Selected - Specify Values. Clicked on expression and keyed in =cdate(today())

      But the value was showing blank. Is that the way it should behave? or did i mess up something. When i go in to Run View no defaults are shown.  

       

       

       

  • Hi 

      If you set available values for your parameter which is coming from another dataset then default value should be part of available values otherwise it will not show anything. 

    Example  - If you have list of date for available values like 1/1/2020, 1/2/2020...... Then if you are using Today() then today's date should be part of available dataset result.

     

    Thanks

    Hari

     

    Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hariharan_R 

       

      I want the report to display today's data once the user clicks on the report link. Is that possible with Paginated report. 

      I want the users be allowed to pick a parameter and execute for any other date.  

      • d_gosbell's avatar
        d_gosbell
        Icon for Super User rankSuper User

        Anonymous wrote:

        Hariharan_R 

         

        I want the report to display today's data once the user clicks on the report link. Is that possible with Paginated report. 

        I want the users be allowed to pick a parameter and execute for any other date.  


        It's definitely possible and I can't see why it's not working this way now. As Hariharan_R suggested, have you checked the available values setting. I often leave this blank for datetime parameters. But if it was using a dataset that returned text values instead of datetime values you would get an error like you first reported. And if it was returning a set of dates that did not include today's date the parameter would be blank when you run the report as the default was not one of the allowed values

  • Hi,

    Go to your Dataset Properties

    then go to Parameter section

    in paramter value write below expression
    =Format(Parameters!CalendarDate.Value, "MM/dd/yyyy")
    click ok and try to run report it will solved your issue.
    Note;- you can change date format as you want.

    Hope this will help you.