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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Domen
Frequent Visitor

Help with old row value to the new row in created table

Hello

 

I have created a table from table that uses DirectQuery with the following code:

 

Test =

SUMMARIZE (

    ALL(

        'msg StandardMessage (2)'[Customer Id],

        'msg StandardMessage (2)'[Time],

        'msg StandardMessage (2)'[Longitude],

        'msg StandardMessage (2)'[Latitude]

    ),

    'msg StandardMessage (2)'[Time],

    'msg StandardMessage (2)'[Latitude],

    'msg StandardMessage (2)'[Longitude],

    'msg StandardMessage (2)'[Customer Id]

)

 

This is how the table looks like:

 

Customer ID

Time

Longitude

Latitude

2

3/6/2023 20:42

124

456

2

3/6/2023 20:43

126

459

2

3/6/2023 20:44

128

462

2

3/6/2023 20:51

130

465

2

3/6/2023 21:43

132

468

2

3/6/2023 22:11

134

471

2

3/6/2023 22:12

136

474

2

3/6/2023 22:12

138

477

2

3/6/2023 22:16

140

480

2

3/6/2023 22:16

142

483

2

3/6/2023 22:23

144

486

 

I would like to add the following three columns (Previous Time, Previous Latitude, Previous Longitude) which will be used for calculation of the distance in KM from the previous location to the current location. 

 

Customer ID

Time

Longitude

Latitude

Previous Time

Previous Latitude

Previous Longitude

2

3/6/2023 20:42

124

456

 

 

 

2

3/6/2023 20:43

126

459

3/6/2023 20:42

124

456

2

3/6/2023 20:44

128

462

3/6/2023 20:43

126

459

2

3/6/2023 20:51

130

465

3/6/2023 20:44

128

462

2

3/6/2023 21:43

132

468

3/6/2023 20:51

130

465

2

3/6/2023 22:11

134

471

3/6/2023 21:43

132

468

2

3/6/2023 22:12

136

474

3/6/2023 22:11

134

471

2

3/6/2023 22:12

138

477

3/6/2023 22:12

136

474

2

3/6/2023 22:16

140

480

3/6/2023 22:12

138

477

2

3/6/2023 22:16

142

483

3/6/2023 22:16

140

480

2

3/6/2023 22:23

144

486

3/6/2023 22:16

142

483

 

The table contains multiple Customer ID's which will be filtered by a slicer from another table (so the calculation of the previous lat and long must be made on the fly). The table must show only data from the selected Customer ID and must be ordered by time ascending (ascending is curently done by filtering). 

 

I have tried to do this through PowerQuery, but it is not allowed for calculated tables. 

 

1 REPLY 1
lbendlin
Super User
Super User

if your data source is in Direct Query mode you can only add columns that are derived from other columns in the same row.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors