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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Referencing previous row in column: Performance issues

Hi, I would like to create a calculated column that references the previous row (in respect to a date/time column). I have a solution, but it requires too much computation to finish (I am running the column on 24 million rows, it has been calculating for 15 hours).

 

I have included a table below as an example, [Goal Column] is the column I am trying to calculate. As you can see, it is referencing the [hook_load] for the prior [Regular Date Time.1] (which also happens ot be the prior row in the sorting of this example table). 

 

I've also included a screenshot of my currently existing code (which takes too long). It's still calculating so I can't include a text version. 

 

Thanks in advance, I appreicate your support! 

 

 

time_traces_10s_view   
WellRegular Date Time.1hook_loadGoal Column (previous [hook_load]_
justin6/1/2021 5:0010-
justin6/1/2021 5:10510
justin6/1/2021 5:2045
justin6/1/2021 5:3054
justin6/1/2021 5:4075
justin6/1/2021 5:5057
justin6/1/2021 6:0065
justin6/1/2021 6:1056
brett6/4/2021 2:104-
brett6/4/2021 2:2054
brett6/4/2021 2:3085
brett6/4/2021 2:4048
brett6/4/2021 2:5054
brett6/4/2021 3:0075
brett6/4/2021 3:1057

 


Jkilb_0-1623759459329.png

 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

what exactly is your data source? You could check if the approach in Power Query is faster or more efficient than in DAX. Check the approach in Power Query:

Value from previous row – Power Query, M language – Trainings, consultancy (exceltown.com)

Or

Refer to Previous Row and Next Row in Power Query - Goodly

 

Otherwise is it possible to add an index column in Power Query? Then you can just filter the rows to [index]-1 to get the previous row. That should be faster from my feeling:

Find a Value in the Previous Row | Burningsuit

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

1 REPLY 1
selimovd
Super User
Super User

Hey @Anonymous ,

 

what exactly is your data source? You could check if the approach in Power Query is faster or more efficient than in DAX. Check the approach in Power Query:

Value from previous row – Power Query, M language – Trainings, consultancy (exceltown.com)

Or

Refer to Previous Row and Next Row in Power Query - Goodly

 

Otherwise is it possible to add an index column in Power Query? Then you can just filter the rows to [index]-1 to get the previous row. That should be faster from my feeling:

Find a Value in the Previous Row | Burningsuit

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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