Notice that set expression is usewd to create a new subset of data to calculat the expression over, which means it will act more like a filtering of your data before the expression is calculated.
In this case you are looking for a way to compare to fields on the same row in your data. For this you can use a IF statement instead to check if your conditional requirement is fulfilled.
=Count( If( Date_from <= Date_to, Key) )
This menas that if the Date_to is greater or equal to the Date_from the value Key will be added in the Count() otherwise Null will be added, which means taht it will not be counted at all.