Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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.
if your data source is in Direct Query mode you can only add columns that are derived from other columns in the same row.