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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
achanikya
Helper I
Helper I

Rolling 12 YY-Month

Hi Team, 

i want to display sales amount for last 12 Completed month in Line Chart.

 

For Example:

If january 2022 once Came, that time line chart should show the data From Feb-2021 To Jan -2022. Only 12 MOnths

 

Please advice some measures  for displaying completed 12 Months of data.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @achanikya ,

 

If the last 12 months are always based on current date, you could simply use Relative Date filter as shown below:

 

2/11/2021-1/10/2022

Eyelyn9_1-1641794362282.png

 

Or if you want to dynamically change it based on date selection in slicer, please firstly create a date table for slicer, and then create a measure for filter:

ForSlicer = VALUES('Table'[Date])
Measure = 
var _date= DATE(MAX('ForSlicer'[Date].[Year]), MAX('ForSlicer'[Date].[MonthNo]),1)
var _diff= DATEDIFF(MAX('Table'[Date]),_date,MONTH)
return IF(_diff>=0&& _diff<12,1,0)

2021/2/1-2022/1/10

 

Eyelyn9_2-1641794422907.png

 

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @achanikya ,

 

If the last 12 months are always based on current date, you could simply use Relative Date filter as shown below:

 

2/11/2021-1/10/2022

Eyelyn9_1-1641794362282.png

 

Or if you want to dynamically change it based on date selection in slicer, please firstly create a date table for slicer, and then create a measure for filter:

ForSlicer = VALUES('Table'[Date])
Measure = 
var _date= DATE(MAX('ForSlicer'[Date].[Year]), MAX('ForSlicer'[Date].[MonthNo]),1)
var _diff= DATEDIFF(MAX('Table'[Date]),_date,MONTH)
return IF(_diff>=0&& _diff<12,1,0)

2021/2/1-2022/1/10

 

Eyelyn9_2-1641794422907.png

 

 

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

amitchandak
Super User
Super User

@achanikya , if you have not selected a date then

 

//Last 12 based on today
new measure =
var _max = eomonth(today(),0)
var _min = eomonth(today(),-12)+1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

 

Assumes you are using joined date table.

 

But if you filtered Jan 21 and then want 12 months you need an independent date table

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.