Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
105 | |
88 | |
74 | |
66 |
User | Count |
---|---|
126 | |
111 | |
100 | |
83 | |
71 |