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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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))

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. 

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.