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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vapilot75
New Member

Dynamic Partial Calendar

Hello,

 

I'm trying to creare a small table that has only the date of the last day of the month, starting in January of the current year, to the last day of the month of the current month.  For example:

 

January 31, 2019

February 28, 2019

March 31, 2019

April 30, 2019

May 30, 2019

 

I want to do this with a query, so that as soon as June rolls around, June 30 would be added to the list.   Anyone have any ideas?

 

Many thanks,

 

Brandon

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@vapilot75  - You could create a DAX Calculated Table like this:

End Dates = 
var currentmonth = MONTH(TODAY())
var currentyear = YEAR(TODAY()) 
var entireyear = CALENDAR(DATE(currentyear, 1,1), DATE(currentyear,12,31))
var addcols = GENERATE(
    entireyear,
    var basedate = [Date]
    var month = MONTH([Date])
    var endmonth = EOMONTH(basedate,0)
    return ROW(
        "Day", basedate,
        "Month", month,
        "EndOfMonth", endmonth
    )
)
var distinctval = SUMMARIZE(addcols, [Month], [EndOfMonth])
var filtered = FILTER(distinctval, [Month] <=currentmonth)
return filtered

Cheers!

Nathan

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @vapilot75 

You can use Query Editor, M code below.

let
    currentDate = Date.From(DateTime.LocalNow()),
    listMonths = List.Transform({1..Date.Month(currentDate)}, each Date.EndOfMonth(#date(Date.Year(currentDate), _, 1))) 

in
    listMonths

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@vapilot75  - You could create a DAX Calculated Table like this:

End Dates = 
var currentmonth = MONTH(TODAY())
var currentyear = YEAR(TODAY()) 
var entireyear = CALENDAR(DATE(currentyear, 1,1), DATE(currentyear,12,31))
var addcols = GENERATE(
    entireyear,
    var basedate = [Date]
    var month = MONTH([Date])
    var endmonth = EOMONTH(basedate,0)
    return ROW(
        "Day", basedate,
        "Month", month,
        "EndOfMonth", endmonth
    )
)
var distinctval = SUMMARIZE(addcols, [Month], [EndOfMonth])
var filtered = FILTER(distinctval, [Month] <=currentmonth)
return filtered

Cheers!

Nathan

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.