Search code examples
ssassql-server-2014dax

DAX FILTER function with multiple criteria


I have a DAX statement I run inside SSMS.

my original statement is:

evaluate(filter('rptLoan', [RemainingDays] <= 10))

and it works fine. I want to add another criteria as below

evaluate(filter('rptLoan', [RemainingDays] <= 10 and [CloseDt] <> "2017-01-31"))

but it is not working and I get below error

Query (1, 47) Operator or expression 'AND' is not supported in this context.

Please advise. Thank you.


Solution

  • It's simple. You can not use AND. You need to use && instead.

    You also need to convert the string date to date type using DATEVALUE function

    evaluate(filter('rptLoan', [RemainingDays] <= 10 && [CloseDt] <> datevalue("2017-01-31")))