Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calender function

Hello,

I want that the calendar function creates a list of every month of eachyear between my min and max date and not a list of every day of each month of each year. Do you know how to do it pls?

Thank you!

Best regards

  • Hi, Anonymous 

    I am not sure if I understood your question correctly, but please try something like below.

     

     

    Calendar Table =
    SUMMARIZE (
    ADDCOLUMNS (
    CALENDAR ( MIN ( Data[Date] ), MAX ( Data[Date] ) ),
    "month & year", FORMAT ( [Date], "MMM-YYYY" )
    ),
    [month & year]
    )

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

9 Replies

  • Hi, Anonymous 

    I am not sure if I understood your question correctly, but please try something like below.

     

     

    Calendar Table =
    SUMMARIZE (
    ADDCOLUMNS (
    CALENDAR ( MIN ( Data[Date] ), MAX ( Data[Date] ) ),
    "month & year", FORMAT ( [Date], "MMM-YYYY" )
    ),
    [month & year]
    )

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much

      Have a nice day!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Jihwan_Kim hi! juste I got a question what if I want that the result depend on a filter. I got two columns "Name" and "Name2" and I would like to have my column uptaded each time I change the filter. I try to add a Filter() in the dax formula but I didn't succed.

      Can you help me please?

      Thank you

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi, Anonymous 

        Sorry, I quite do not understand your question.

        Can you share your sample pbix file's link here, together with how the expected result looks like?

  • Anonymous ,

     

    Try like

     

    Addcolumns(calendar(Min(Table[Date]), Max(Table[Date]) ), "Month" , month([date]) , "Year", year([date]), "Month Year", format([date],"mmm-yyyy") , "Month year sort", year([date])*100 + month([date]))

     

    or

     

    Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month" , month([date]) , "Year", year([date]), "Month Year", format([date],"mmm-yyyy") , "Month year sort", year([date])*100 + month([date]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for your answer,

      Unfortunately it doesn't work, well it's the good format but I still have a line for each day even if we can see only the month. I think I badly expressed myself but imagine the min date is 01 january 2017 and the max 25 april 2017, I would like to have a list of the following data: january 2017; february 2017; mars 2017; april 2017. Do you think it's possible?

      Thank you!