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
Anonymous
Not applicable

Last 12 month from current one

Hello,

Is there a way to display last 12 month from current month from sales table? So if its current month of Feb as for today, it should show Mar 2022 - Feb 2023.

when Mar 23 become current month Apr 2022-Mar 2023? I have date table also. In date table max date will current date. .

I have to create rolling chart and for that i have to implement a filer by creating a new automated column in date table.

Thanks !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your statement, I know you want show data from Feb 2022 to Feb 2023, if today is in Feb 2023. I think your requirement is to show 13 months instead of 12 months.

If you want to show 12month data, it will show you data from Mar 2022 to Feb 2023. I think amitchandak's code will work.

If you don't want to add a Date table in your table, try this code.

Last 12 months Today = 
var _max= eomonth(today(),0)
var _min= eomonth(_max,-12 ) +1
return
CALCULATE(SUM('Table'[Value]), FILTER('Table','Table'[Date] >=_min && 'Table'[Date] <= _max))

RicoZhou_0-1675242797546.png

 

Best Regards,
Rico Zhou

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , if there is not date filter, try a meausre like

 

Last 12 months Today =
var _max= eomonth(today(),0)
var _min= eomonth(_min,-12 ) +1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

There is a active year filter on the existing chart. Currently the chart is showing from Jan 2022 to current month which is 12 month. Wherreas I want to modify the chart in such a way that when we come to feb 2023 the chart should automatically(after refresh) show the data from Feb 2022 to Feb 2023. 

Anonymous
Not applicable

Hi @Anonymous ,

 

According to your statement, I know you want show data from Feb 2022 to Feb 2023, if today is in Feb 2023. I think your requirement is to show 13 months instead of 12 months.

If you want to show 12month data, it will show you data from Mar 2022 to Feb 2023. I think amitchandak's code will work.

If you don't want to add a Date table in your table, try this code.

Last 12 months Today = 
var _max= eomonth(today(),0)
var _min= eomonth(_max,-12 ) +1
return
CALCULATE(SUM('Table'[Value]), FILTER('Table','Table'[Date] >=_min && 'Table'[Date] <= _max))

RicoZhou_0-1675242797546.png

 

Best Regards,
Rico Zhou

 

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

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.