title: PowerBi DAX write DAX to compare date time
body: <p>I want to set a column value before 2021-1-20 as 0. So I need to compare date time in data. Here is my wrong code.</p>
  <pre><code>ColumnValue = IF([MyDate]&gt;=&quot;1/20/2021&quot;,
  SWITCH([Key],
  &quot;caseA&quot;,[Value],
  &quot;caseB&quot;,[Value],
  &quot;caseC&quot;,[Value],
  &quot;caseD&quot;,-1*[Value],
  &quot;caseE&quot;,-1*[Value],
  0
  ),0)
  </code></pre>
  <p>However, it hints that 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. But I don't know how to compare DAX date time.</p>