Forum Discussion
If Statement with two different data types
- 9 years ago
I found that the solution is to go under "OPTIONS">Data Load, and uncheck "Automatically detect column types and headers for unstructured sources". This automatically converts everything to text and allows you to select the data type for each column.
The easiest option would be to use the Replace Values button in the Query editor instead of creating a new column. Replace 1/1/1900 with null. Literally type the word null into the box.
Anyway if you want to do this as a new DAX column, you need to use DAX rules. You've written an Excel formula. By putting the date in quotation marks and using "" to denote a blank return value, you're treating treating those two things as text rather than dates. You need to use the BLANK() and DATE() formulas.
DeliveryDate = IF( 'Total Trans'[Delivery Date] = DATE(1900, 1, 1), BLANK(), 'Total Trans'[Delivery Date] )
- Sean9 years agoCommunity Champion
Just a reminder although it DOES NOT apply to this question since this is only a comparison NOT a date calculation
the first officially supported date in DAX is March 1, 1900 (for date calculations)
- cheid19779 years agoAdvocate I
I found that the solution is to go under "OPTIONS">Data Load, and uncheck "Automatically detect column types and headers for unstructured sources". This automatically converts everything to text and allows you to select the data type for each column.