Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

DAX Date Parameter Paginated Report Format Error

Hi,

I've created a Startdate and EndDate paramater for my paginated report that I'm referencing in my query.

Both Startdate and EndDate have been set up as below using DateTime, both available and default values are set to None. 

I'm trying to add these two parameters to this query (which works and returns data).

 

EVALUATE
	CALCULATETABLE(
		SUMMARIZECOLUMNS('factfile'[LineID], 'factfile'[Date], 'factfile'[ZKF_VALUE])

 

I think it should go something like this, but I keep receiving errors.

 

EVALUATE
	CALCULATETABLE(
		SUMMARIZECOLUMNS('factfile'[LineID], 'factfile'[Date], 'factfile'[ZKF_VALUE]),
	'Factfile'[Date] >= @StartDate,
	'Factfile'[Date] <= @EndDate)

 

The error I receive is: 

DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

I've tried to format both parameters in the query in the following ways (which work with query builder code), but don't with my simpler DAX.

Has anyone figured out how to get around this?

 

 

4 Replies

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    Did you check that this field is a date type field? Also, even by customising the date type, it needs to meet a recognisable date type, otherwise after FORMAT it corresponds to a text type.

    Factfile'[Date]

     

    refer to below:

    Power BI Date Formatting | How to Change Date Format in Power BI? (wallstreetmojo.com)


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-henryk-mstf 

       

      Hi Henry,

       

      Thanks for the response. I've set my date field to be a dd/mm/yyyy format in my data set and in PBI RB I've tried to write in the paramter to be this same format. I've also included the error message below. This must be a simple fix?

       

       

       

       

      Query (4, 2) DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
      ----------------------------
      Query execution failed for dataset 'Factfile2'.
      ----------------------------
      An error has occurred during report processing.
      ----------------------------
      An error occurred during local report processing.