Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pbi07
Helper V
Helper V

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.

Pbi07_0-1622320533270.png

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? 

 

Pbi07_1-1622320729910.png

 

 

8 REPLIES 8
ashishg
Advocate I
Advocate I

Hi,

Go to your Dataset Properties

then go to Parameter section

ashishg_0-1669972620362.png

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.

 

Hariharan_R
Solution Sage
Solution Sage

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

@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.  


@Pbi07 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

d_gosbell
Super User
Super User

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.

@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.  

Pbi07_0-1622670030685.png

 

 

 

d_gosbell
Super User
Super User

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

@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 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.