M Formula for 'Text' Months from Week Values

dburke

New member
Joined
Apr 1, 2016
Messages
25
Reaction score
0
Points
0
Does anyone know an M formula that will convert a week value into a text month (ie change week = 4/4/2015 into 'Apr' instead of '4')?

My current process
1) convert 'Week' column to a numeric month (ie 4/4/2016 becomes '4')
2) create a new 'Month' column and fill using formula

if [Month]= 1 then "Jan"
else if [Month] = 2 then "Feb"
else if [Month]= 3 then "Mar"
else if [Month] = 4 then "Apr" . . .

3) go back and delete the original 'Week' column

This works but it's too many steps. Seems like it could be simplified using something like the 'Number.ToText' forumla.
 
No problem. For reference, if you're interested, pages 219-220 of M is for Data Monkey lists over 20 different M formulas for converting dates into a variety of formats (including their Excel formula counterparts.)
 
Thank you. It works beautifully.

Yes, I see it now. I was an early subscriber to your book (excellent resource)

My limitation is that I usually need a 'real world' scenario for the formula to make sense.

Example
Scenario: Doug wants to convert week column value '4/4/2016' into text month 'Apr' using a simple M formula
Answer: Doug should use M formula Date.ToText([Week],"MMM")

Perhaps your next book could be a series of short business use cases for each formula (similar to M is for Data Monkey but focused on the M Formula Reference). The book could probably write itself. I would find it very useful.
 
Back
Top