Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I am importing data into Report Builder using a dataset.
I am a bit unfamilar with DAX Querying, so I used the Query Designer and dragged in Client ID, Client Name, and Total Sales into the query. I also want the user to be able to choose between two date, so I dragged in the Date column from the Calendar table into the parameters section and checked off both parameter boxes for the From and To date.
The result is the following query :
DEFINE
VAR vFromCalendarDate1 =
IF (
PATHLENGTH ( @FromCalendarDate ) = 1,
IF ( @FromCalendarDate <> "", @FromCalendarDate, BLANK () ),
IF (
PATHITEM ( @FromCalendarDate, 2 ) <> "",
PATHITEM ( @FromCalendarDate, 2 ),
BLANK ()
)
)
VAR vFromCalendarDate1ALL =
PATHLENGTH ( @FromCalendarDate ) > 1
&& PATHITEM ( @FromCalendarDate, 1, 1 ) < 1
VAR vToCalendarDate1 =
IF (
PATHLENGTH ( @ToCalendarDate ) = 1,
IF ( @ToCalendarDate <> "", @ToCalendarDate, BLANK () ),
IF (
PATHITEM ( @ToCalendarDate, 2 ) <> "",
PATHITEM ( @ToCalendarDate, 2 ),
BLANK ()
)
)
VAR vToCalendarDate1ALL =
PATHLENGTH ( @ToCalendarDate ) > 1
&& PATHITEM ( @ToCalendarDate, 1, 1 ) < 1
EVALUATE
SUMMARIZECOLUMNS (
'Sales'[Client_ID],
'Client'[Client_Name],
RSCUSTOMDAXFILTER (
@ClientClient_Name,
EqualToCondition,
[Client].[Client_Name],
String
),
FILTER (
VALUES ( 'Calendar'[Date] ),
(
vFromCalendarDate1ALL
|| 'Calendar'[Date]
>= DATEVALUE ( vFromCalendarDate1 ) + TIMEVALUE ( vFromCalendarDate1 )
)
&& (
vToCalendarDate1ALL
|| 'Calendar'[Date]
<= DATEVALUE ( vToCalendarDate1 ) + TIMEVALUE ( vToCalendarDate1 )
)
),
"Total Sales", [Total Sales],
)
When I try to run the report, I see the parameter that I set up for the date as per the screenshot below:
However, after I select the date and click "View Report", I get an error:
"Query (1, 74) 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."
What I've done:
I've checked the parameter properties for the two date parameters, and both are already set to "Date/Time" as the type. Available values is set to None, and Default values is set to None as well.
In PowerBI, this field was created using the CALENDAR() table function:
Calendar =
CALENDAR (
DATE ( YEAR ( MIN(Claims[IncurredDateFormatted]) ), 1, 1),
DATE ( YEAR ( MAX(Claims[IncurredDateFormatted]) ), 12, 31)
)
So it should already be in datetime format. Does anyone know where my error is coming from?