Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Distinct months..?

Hi,

I have dates in a table with the format yyyymmdd.

I want to populate a list in a report with distinct months with the format mmm

How can I do this?

 

Kent J.

  • Anonymous's avatar
    Anonymous
    4 years ago

    I created a copy of the column ProductionDate with the format 'mmmyyyy'. Then I grouped by the copy (MonthYear) and summarized 'ItemCount'. Success!

7 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    You may try

    Month =
    VAR CurrDate =
        SELECTEDVALUE ( Table[Date] )
    RETURN
        FORMAT ( DATE ( 1, MONTH ( CurrDate ), 1 ), "mmm" )
  • tackytechtom's avatar
    tackytechtom
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi Anonymous ,

     

    How about creating a custom column like this:

     

    Here the code:

    CustomColumn = 
    FORMAT (
        DATE ( 
            LEFT ( [date], 4 ),
            RIGHT ( LEFT ( [date] ,6 ), 2 ),
            RIGHT ( [date], 2 )
        ), 
        "mmm"
    )

     

    After that you can either use that column in a report:

     

     

    Or you create a separate custom table like this:

     

    Let me know, if this helps!

     

    /Tom
    https://www.tackytech.blog/
    https://www.instagram.com/tackytechtom/