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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Pandadev
Post Prodigy
Post Prodigy

Out of memory issue on formula looking to find where there is more than 7 days between dates

Hi I'm trying to calculate based on the identification code and the date of departure, the length of time between the next previous departure date, so I can filter only those that are greater than or equal to 7 days.

I've tried these formulas, but I only get an out-of-memory error. Is there a more efficient way to do this please.

PreviousDateCalculation = CALCULATE(max('TU Feed'[departure]),FILTER('TU Feed','TU Feed'[ID]'EARLIER('TU Feed'[ID])&&'TU Feed'[departure]<EARLIER('TU Feed'[departure])))
DateDiffCalculation = DATEDIFF('TU Feed'[PreviousDateCalculation],'TU Feed'[departure],DAY)

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

Something doesn't appear correct. See the addition of the = sign.

 

PreviousDateCalculation = 
  CALCULATE(
    max('TU Feed'[departure]),
    FILTER(
      'TU Feed',
      'TU Feed'[ID]' = EARLIER('TU Feed'[ID]) &&
      'TU Feed'[departure] < EARLIER('TU Feed'[departure])
    )
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thankyou that now works , is it possible to have this work in reverse format so the row will show the date diff from the next date

so if I had a departure on 01/04/2020 for ID 001 and I then had a next departure on 18/04/2020 for ID 001 the row with

ID      Departure     Next Date      Diff

001    01/04/2020  18/04/2020    18

Well, if you had all of that in a row in a table, you could just do:

 

Column = ([Next Date] - [Departure]) * 1.

 

Not sure of how your data is organized though.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I have about 8 million rows of data , and 45,000 different ID's , so it's format is a bit all over the palce , which was why I was trying to create a formula

I guess the question I have is, when you posted:

ID Departure Next Date Diff

001 01/04/2020 18/04/2020 18

Is that source data, how it looks or is that information displaying in a table visual and those columns come from different places in the source data?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

It is a visual of how I would like it to look.

I have columns in a table called TU Feed

ID

departure date

 

There are 8 million rows of data with 25,000 different ID's

each row will have an ID and it's departure date.

I am looking to show all instances where there is 7 or more days before the next departure date for each ID

So I was looking to add a column with next date , and another column with the date diff.

I can then filter my visual to only show date diffs of 7 or more

 

OK, well, if ID is a column from a table and you have a Departure measure and Next Date measure, the formula would be the same essentially:

 

Measure = ([Next Date] - [Departure]) * 1.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors