cancel
Showing results for 
Search instead for 
Did you mean: 

Compare a dimension (date) to a chosen date

former_member597137
Participant
0 Kudos

Hi,

I would like to create a variable with a "If" condition which looks like this:

If [date dimension] > 01/15/2019 Then ....

The date dimension has a format mm/dd/yyyy. How do I do to compare it to any date I want?

Thanks

Marc

Accepted Solutions (1)

Accepted Solutions (1)

ayman_salem
Active Contributor

the best way to do that is to format the date to "yyyyMMdd" and convert to number and then compare:

ex:

RefDate =ToDate("07/19/2014";"MM/dd/yyyy")

compareResult =If (ToNumber (FormatDate ([Transaction Date]; "yyyyMMdd")) > ToNumber (FormatDate ([RefDate]; "yyyyMMdd"))) Then 1 Else 0

Answers (0)