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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
rmitchell
Frequent Visitor

Rolling 12 month Total - error with leap year?

I'm using the following measure to show LTM Actual Sales but am getting an incorrect figure for February 2017 which I'm thinking must be something to do with 2016 being a leap year? Any ideas how I can work around this?

 

LTM Actual Sales = 
CALCULATE(
	[Actual Sales],
	DATESBETWEEN(
		DateTable[Date],
		NEXTDAY (SAMEPERIODLASTYEAR ( LASTDATE(DateTable[Date] ) ) ),
		LASTDATE(DateTable[Date])
	)
)

 

 

1 ACCEPTED SOLUTION
rmitchell
Frequent Visitor

I solved this by swapping the order of the formulas around so I now have:

LTM Actual Sales = 
CALCULATE(
	[Actual Sales],
	DATESBETWEEN(
		DateTable[Date],
		SAMEPERIODLASTYEAR( NEXTDAY  ( LASTDATE(DateTable[Date] ) ) ),
		LASTDATE(DateTable[Date])
	)
)

View solution in original post

1 REPLY 1
rmitchell
Frequent Visitor

I solved this by swapping the order of the formulas around so I now have:

LTM Actual Sales = 
CALCULATE(
	[Actual Sales],
	DATESBETWEEN(
		DateTable[Date],
		SAMEPERIODLASTYEAR( NEXTDAY  ( LASTDATE(DateTable[Date] ) ) ),
		LASTDATE(DateTable[Date])
	)
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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