Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
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.
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.
It appears that unintentionally hidden date datasets may have been generated. To address this, please follow these steps: Right-click on the Datasets, select "Show Hidden," and proceed to delete the two hidden datasets.
It's possible that these datasets were inadvertently created through the use of the "Available Values" option on each parameter, which automatically generates DAX data tables. In my experience, these hidden tables often include a NULL record, contributing to the issue you've described.
If your intention was to utilize Available Values for a specific purpose, the aforementioned suggestion may not be applicable to your situation. Feel free to provide more details if additional assistance is required.
Maybe make sure the text is date type in the DAX query? https://learn.microsoft.com/en-us/dax/date-and-time-functions-dax
Something like: DATEVALUE(@StartDate)
User | Count |
---|---|
3 | |
3 | |
2 | |
2 | |
1 |
User | Count |
---|---|
8 | |
4 | |
4 | |
3 | |
3 |