Forum Discussion
Getting DAX error: DAX doesn't support comparing values of type Text with type Date
Hi All,
I have a Student table with columns:-
| StudentID | StudentName | AdmissionDate | LastAttendanceDate | DateLeft | Location | Studenttype |
I have a calendar table connected to student table by 1:n relation.
I want to exclude all the rows when the Maxiumum selected value of [Datescolumn of the calendar table]in the date slicer is greater than the Date Left column of the student Table.
| StudentID | StudentName | AdmissionDate | LastAttendanceDate | DateLeft | Location | Studenttype |
| 100 | Harry | 01-02-2010 | 10-05-2011 10:45 | 01-06-2011 | London | FullTime |
| 101 | Sally | 01-02-2010 | 01-05-2011 16:45 | London | FullTime | |
| 103 | Mary | 01-02-2010 | 02-05-2011 12:45 | London | FullTime | |
| 104 | John | 01-02-2011 | 07-05-2011 09:45 | 31-09-2011 | Paris | FullTime |
| 105 | Geeta | 01-04-2011 | 13-05-2011 12:45 | Athens | FullTime | |
| 106 | James | 01-02-2011 | 02-05-2011 12:45 | Athens | FullTime | |
| 107 | Marc | 01-02-2010 | 11-05-2011 12:45 | 14-05-2011 | Athens | PartTime |
| 108 | Sam | 01-04-2011 | 02-05-2011 14:45 | 02-10-2011 | Toronto | PartTime |
| 109 | Ravi | 01-04-2010 | 04-05-2011 12:45 | Toronto | PartTime | |
| 110 | Jose | 01-02-2011 | 08-05-2011 15:45 | 03-08-2011 | Tokyo | FullTime |
It looks like your field 'student'[DateLeft] is set as type text. Select the field in the fields bucket and under "Column Tools" in the ribbon, set the field type to type Date:
3 Replies
- PaulDBrown
Community Champion
It looks like your field 'student'[DateLeft] is set as type text. Select the field in the fields bucket and under "Column Tools" in the ribbon, set the field type to type Date:
- deb_power123
Helper V
Thankyou, yes it was a miss from my end.It automatically became text, not sure how.The forumla now works fine
- PaulDBrown
Community Champion
It was propably formatted as text in the import phase. Power Query has a habit of establishing field data types automatically, but doesn't always get it right.
you can check by opening the query and checking the code in the "Changed type" step, and edit accordingly if need be)