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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
masry
Regular Visitor

SAMEPERIODLASTYEAR() function

Ex : I have number of passengers of the current month 5/2017 and I need to get the number of passengers for the same month of the last year 5/2016 , so I used the DAX function (SAMEPERIODLASTYEAR) but it didn’t work with me as this fun just work with dates on the level days not on the minutes or seconds level .

Our date example in our data : ‘2015-01-01 00:04:00’ , ‘2015-01-01 00:05:00’ , ....

any help ?

2 REPLIES 2
v-caliao-msft
Microsoft Employee
Microsoft Employee

@masry,

 

this fun just work with dates on the level days not on the minutes or seconds level

If this is the case, so you could duplicate this column and change this column's data type from date/time to date.

 

Regards,

Charlie Liao

vanessafvg
Community Champion
Community Champion

have you got a date table?  always best practice to use a date table working off a date type data type rather than date time i would think.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors