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
Natalia10000
Frequent Visitor

List of dates from previous Year

I would like to write DAX formula which would take a selected list of dates and provide me with the same dates but from Last year,

 

List of currecnt dates:

VAR weeksel = CALCULATETABLE(VALUES('Date'[Date]),'Date'[Year Week]=prevYearWeeks+1)
 
Now I would like to have the same dates but from 1 year earlier, I tried DATEADD as below:
VAR weeksel = CALCULATETABLE(DATEADD('Date'[Date],-364,DAY),'Date'[Year Week]=prevYearWeeks+1)
 
but if I have random lits of dates that are not continous I got and error.
Could you please help me?
 
Thank you in advance,
Natalia
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Natalia10000 ,

 

You can try the following DAX:

FILTER(ALL('Date'),
    'Date'[Date]>=
EDATE(MIN('Date'[Date]),-12)&&'Date'[Date]<=TODAY())

Refer to :

EDATE function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Liu Yang

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

4 REPLIES 4
Anonymous
Not applicable

Hi  @Natalia10000 ,

 

You can try the following DAX:

FILTER(ALL('Date'),
    'Date'[Date]>=
EDATE(MIN('Date'[Date]),-12)&&'Date'[Date]<=TODAY())

Refer to :

EDATE function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Liu Yang

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

khaledHabib90
Resolver II
Resolver II

consider using this function:

SAMEPERIODLASTYEAR('Date'[Date])

in the filter Argument of the calculate function

 

If my reply helped you solve the problem please accept it as the solution 🙂

Hi, thank you for Your response, but this one also needs continuous dates selection? I mean there should be no gaps between dates?

To be more specific the dates that I have is the random selection of days

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.

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.