Search code examples
powerbidaxpowerquerypowerpivot

Convert 1 to 12 (number type) to January to December using just Power Query and not with DAX


How do I replicate the below DAX Calculated column solution to a Power Query Custom Column solution instead?

Short Month =
SWITCH (
    Some_Table_Name[Month],
    1, "Jan",
    2, "Feb",
    3, "Mar",
    4, "Apr",
    5, "May",
    6, "Jun",
    7, "Jul",
    8, "Aug",
    9, "Sep",
    10, "Oct",
    11, "Nov",
    12, "Dec",
    BLANK ()
)

I know I can just use the DAX solution but if it can be done via Power Query then I would appreciate if I would learn or know it too.

enter image description here


Solution

  • You can use it as part of a date and convert to text:

    Date.ToText(#date(2000,[Month],1),"MMM")