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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
n8ball
Advocate I
Advocate I

DATESINPERIOD from Last Date in table giving strange results

My date table contains 1/1/2017 through 1/16/2020

When I execute this:

 

Table = DATESINPERIOD ( 'Date'[Date], MAX('Date'[Date]), -1, YEAR )

 

My first date in the table is 2/1/2019. I would expect 1/17/2019. When I use -365, DAYS instead of -1, YEAR it works as expected.

 

However, when I use:

 

Table = DATESINPERIOD ( 'Date'[Date], MAX('Date'[Date])-1, -1, YEAR )

 

The first date is 1/16/2019 as I would expect.

Any idea why this is happening and what I can do to correct?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @n8ball 

it is difficult to describe but it is logical

for datesbetween the start day (day+month in your case) of returned table could not be equal max day (day+max) 

-1 year means that returned dataset will start from 1 year exactly +1 day

try to read this article https://radacad.com/datesinperiod-vs-datesbetween-dax-time-intelligence-for-power-bi to understand more


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @n8ball 

it is difficult to describe but it is logical

for datesbetween the start day (day+month in your case) of returned table could not be equal max day (day+max) 

-1 year means that returned dataset will start from 1 year exactly +1 day

try to read this article https://radacad.com/datesinperiod-vs-datesbetween-dax-time-intelligence-for-power-bi to understand more


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thanks I thougth something like that was happening but I couldn't find any confirmation. Time intelegence functions get funky at the ends of the date table. Do people normally just make date tables largerger than needed? Or do they use differnt DAX to achieve the result I'm looking for?

az38
Community Champion
Community Champion

@n8ball 

usually to create calendar table CALENDAR() and CALENDARAUTO() function are used.

functions like datesinperiod() or datesbetween() are being used for filtering inside calculation. and from this point of view it has a lot of sence to avoid some duplicate. usually if you try to calculate smth for last rolling year, your calculated period will not start from the same day that end day, in common case it will be next day


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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