Forum Discussion
vincenardo
Helper I
4 years agoCompare Month and Year between two date fields
I have a table that has two dates for each record (TransDate & COCDate), I want to create a calculated column that will compare the Month and Year of 'TransDate' to the 'COCDate' and return BEFORE, I...
- Anonymous4 years ago
vincenardo please try a Calculated Column with this DAX formula:
DateStatus = SWITCH(TRUE(), DATEDIFF([TransDate], [COCDate], MONTH) = 0, "IN", DATEDIFF([TransDate], [COCDate], MONTH) < 0, "BEFORE", DATEDIFF([TransDate], [COCDate], MONTH) > 0, "AFTER" )
Anonymous
4 years agoNot applicable
vincenardo please try a Calculated Column with this DAX formula:
DateStatus =
SWITCH(TRUE(),
DATEDIFF([TransDate], [COCDate], MONTH) = 0, "IN",
DATEDIFF([TransDate], [COCDate], MONTH) < 0, "BEFORE",
DATEDIFF([TransDate], [COCDate], MONTH) > 0, "AFTER"
)- vincenardo4 years ago
Helper I
Thank you, worked perfectly!