Use the Ticks function to compare dates with each other. For example calculating the number of days between two dates, you should convert the dates to Ticks first, subtract these from eachother and convert the result to the number of days back again.

Ticks are the 100 nanoseconds interval ticks since 1 Jan 1601. Each day has 864000000000 ticks.

So to calculate the number of days between Date1 and Date2, you may use the following expression:

div(sub(ticks(variables(‘Date2’)),ticks(variables(‘Date1’))), 864000000000)

More info in this blog: