Forum Discussion

HannahEngelson's avatar
HannahEngelson
Qrew Trainee
13 days ago

Date to show as MMM YY

I have a due month formula field that needs to be sorted and reported by date and not by text. I'm trying to have it show as MMMYY (JAN24, FEB24, etc) since it's just a due month and not a specific date. I have a "dummy" date field that's the first day of the month, and I am using a formula text field to get the right formatting I need. I have the date field formatted as the abbreviated month, but it still includes the day.

I'm using the formula below, but it says the first Month (red and bolded below) can't be used as a variable name. I copied this from another thread that worked for everyone who responded in it. What should I put there instead to get the date to change to the text month? Am I missing a step somewhere? Is this even the right way to go about this? 

var date DateWords = [My Date Field];
var text Month = Case(Month($DateWords),
1, "JAN",
2, "FEB",
3, "MAR",
4, "APR",
5, "MAY",
6, "JUN",
7, "JUL",
8,"AUG",
9,"SEP",
10,"OCT",
11,"NOV",
12,"DEC");

$Month & "  " & ToText(Year($DateWords))

1 Reply

  • Your formula is fine - Month is just special since it's also the name of a formula to get the month as you're doing. Just change the variable name from var text month to anything else, something like var text monthT = ... and you'll be fine.