Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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, IN or AFTER.
For Example;
1. TransDate = 12/1/2021 and COC Date = 12/4/2021 returns IN
2. TransDate = 12/1/2021 and COC Date = 11/1/2020 returns BEFORE
3. TransDate = 12/2/2021 and COC Date = 1/1/2022 returns AFTER
Suggestions are appreciated!
Solved! Go to Solution.
@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"
)
@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"
)
Thank you, worked perfectly!
User | Count |
---|---|
98 | |
87 | |
77 | |
67 | |
63 |
User | Count |
---|---|
110 | |
95 | |
95 | |
64 | |
58 |