Forum Discussion

Del235's avatar
Del235
Icon for Helper III rankHelper III
2 years ago
Solved

convert date to month name

How do I convert date to month name?  I see the dax to convert date to month number but not month name

 

  • In the data view,

    create two columns. one for month number and other for month name. 

    Month Number = Format([YourDate], "MM")
    Month Name = Format([YourDate], "MMM")

     

    select the month name column, in the column tools menu, click "Sort by column". Here, by default it will show the month name column. Now, you click "Month number" column. 

     

    In all your visuals of month name, it will be sorted by Month number.

     

    Optional: you can hide the month number column for the users.

     

    Hope it helps!

  • Hello Del235 ,

     

    can you show us what do you have, the scenario you're working on so we could help.

  • Del235's avatar
    Del235
    2 years ago

    I have something like this, so this does work.  I didn't want two columns. 

10 Replies

  • StuartSmith's avatar
    StuartSmith
    Icon for Power Participant rankPower Participant

    You could try... and change to the desired format.

     

  • HI Del235 

     

    You can use

     

    Monthname = FORMAT('Table'[date_column], "MMM")

     

    Thanks and Regards,

    Sayali

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful!! 

  • How do I make the data type date?  What I'm trying to do is get the Month name to to sort as Jan - Dec.  This leaves it as text and sorts alphabetically

    • sevenhills's avatar
      sevenhills
      Icon for Super User rankSuper User

      In the data view,

      create two columns. one for month number and other for month name. 

      Month Number = Format([YourDate], "MM")
      Month Name = Format([YourDate], "MMM")

       

      select the month name column, in the column tools menu, click "Sort by column". Here, by default it will show the month name column. Now, you click "Month number" column. 

       

      In all your visuals of month name, it will be sorted by Month number.

       

      Optional: you can hide the month number column for the users.

       

      Hope it helps!

      • Del235's avatar
        Del235
        Icon for Helper III rankHelper III

        I have something like this, so this does work.  I didn't want two columns. 

    • Idrissshatila's avatar
      Idrissshatila
      Icon for Super User rankSuper User

      Hello Del235 ,

       

      can you show us what do you have, the scenario you're working on so we could help.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Use the below code:

     

    MonthName = FORMAT(Table[Date], "MMM")

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Del235 ,

    You could try StuartSmith's suggestion to format the date column, for Format() function, it will return a text type value.

    If you want to sort the month from Jan to Dec, you could try sevenhills 's suggestion, create a new column with month number, sort the month number column, then sort the month name column by month number column.

     

    Note: In Power BI, for text value, it sort by the ascii value.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • You'll see the name of the month, such as "January" or "February."
    Just like in letter reverser, where you change the style of the text, here you change the format of the date!