Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
eggwald
Frequent Visitor

Month List Table

Hello, 

 

I am really struggling on this. It seems like it should be easy, but I think I am missing something! 🙂

 

I need a table with a list of months starting April 2020 to today and have it automatically update with the new months as time goes on. 

 

Any ideas?

 

Cheers

Ed

2 ACCEPTED SOLUTIONS
BA_Pete
Super User
Super User

Hi Ed,

 

Try this Power Query solution:

let
    Source =
    List.Distinct(
        List.Transform(
            { Number.From(#date(2020,4,1))..Number.From(Date.From(DateTime.LocalNow())) },
            each Text.Combine(
                {
                   Text.Start(Date.MonthName(Date.From(_)), 3),
                   Text.End(Text.From(Date.Year(Date.From(_))), 2)
                }, "-"
            )
        )
    ),
    convertToTable = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    convertToTable

 

For this output:

BA_Pete_0-1697109017474.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

months = var t1 = CALENDAR(DATE(2020, 4, 1), TODAY()) var t2 = ADDCOLUMNS(t1, "time_y", format([Date], "yyyy"), "time_ym", format([Date], "yyyy-MM") ) var t3 = GROUPBY(t2, [time_y], [time_ym], "d1", minx(CURRENTGROUP(), [Date]), "d2", maxx(CURRENTGROUP(), [Date])) return t3

View solution in original post

5 REPLIES 5
BA_Pete
Super User
Super User

Hi Ed,

 

Try this Power Query solution:

let
    Source =
    List.Distinct(
        List.Transform(
            { Number.From(#date(2020,4,1))..Number.From(Date.From(DateTime.LocalNow())) },
            each Text.Combine(
                {
                   Text.Start(Date.MonthName(Date.From(_)), 3),
                   Text.End(Text.From(Date.Year(Date.From(_))), 2)
                }, "-"
            )
        )
    ),
    convertToTable = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    convertToTable

 

For this output:

BA_Pete_0-1697109017474.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




months = var t1 = CALENDAR(DATE(2020, 4, 1), TODAY()) var t2 = ADDCOLUMNS(t1, "time_y", format([Date], "yyyy"), "time_ym", format([Date], "yyyy-MM") ) var t3 = GROUPBY(t2, [time_y], [time_ym], "d1", minx(CURRENTGROUP(), [Date]), "d2", maxx(CURRENTGROUP(), [Date])) return t3

rubayatyasmin
Super User
Super User

Hi, @eggwald 

 

use calender()

create a new table in pbi desktop and pasete this dax

CalendarTable = CALENDAR(DATE(2020, 4, 1), TODAY())

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Thanks @rubayatyasmin, is there a way to get it to just show the months?

EG: 

Apr-20
May-20
Jun-20
Jul-20

....etc

@eggwald 

 

from the data view select the column and check for format option in the ribon. Select your desired format for that. Or use FORMAT DAX function. 

rubayatyasmin_0-1697017337093.png

 

refer: https://learn.microsoft.com/en-us/dax/format-function-dax

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.