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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Last 12 Months

Hi Experts

 

i cannot understand why i am getting constant on the previous 12 months DAX Measure when i add the measure to my calender table....to see the end results...

 

Rolling 12 till last month FEP =
VAR EndDatelastMonth =
EOMONTH(TODAY(),-1)
 
VAR StartDate =
DATE(YEAR(TODAY()),-12,1)

VAR Result =
CALCULATE(
[MONTHLY TOTAL (FEP)],
 
DATESBETWEEN( 'Calendar'[Date], StartDate, EndDatelastMonth )
)
RETURN
Result
1 ACCEPTED SOLUTION

That is because the measure is not taking into account the calendar table, it is using fixed values. If you want to show the total value for the previous 12 months taking into account your calendar table you can use

Rolling 12 till last month FEP =
VAR EndDatelastMonth = MAX('Calendar'[Date])

VAR StartDate = DATE(YEAR(EndDatelastMonth) - 1,MONTH(EndDatelastMonth),1)

VAR Result = CALCULATE( [MONTHLY TOTAL (FEP)],
	REMOVEFILTERS('Calendar'),
	DATESBETWEEN( 'Calendar'[Date], StartDate, EndDatelastMonth ))
RETURN
Result

View solution in original post

5 REPLIES 5
johnt75
Super User
Super User

Change your start date to  DATE( YEAR(TODAY())-1, MONTH(TODAY()), 1)

Anonymous
Not applicable

My Start date should be start of the month 12 months ago....not the previous month??? unless i am missing something

My formula is giving the start of the current month last year, so at the moment it is returning 2021-03-01. It is just subtracting 1 from the current year.

Anonymous
Not applicable

Ok but i am getting  constant value when i use Year and Month from the calenar table and plot this on a bar chart

That is because the measure is not taking into account the calendar table, it is using fixed values. If you want to show the total value for the previous 12 months taking into account your calendar table you can use

Rolling 12 till last month FEP =
VAR EndDatelastMonth = MAX('Calendar'[Date])

VAR StartDate = DATE(YEAR(EndDatelastMonth) - 1,MONTH(EndDatelastMonth),1)

VAR Result = CALCULATE( [MONTHLY TOTAL (FEP)],
	REMOVEFILTERS('Calendar'),
	DATESBETWEEN( 'Calendar'[Date], StartDate, EndDatelastMonth ))
RETURN
Result

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.