cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## How to: Relate Tables Between Dates

Hi
I'm trying to relate 2 tables but I'm not succeeding so I would like the help of the community.
I need to bring the invoice number information from table 1 to geographic positioning table 2.

Table 1 is constructed of a stratum of invoices for all vehicles in the year (each line being an invoice)
In table 1 I have the information in a single line containing: "date of start of transport", "license plate", "date of end of transport" and "note number"

Table 2 is an extract from a set of trackers. Containing the latitude and longitude of each vehicle on a minute-by-minute basis. Table 2 has the fields "date" and "time" , "plate", "latitude" , "longitude"

To build my report, I need to put the note number from Table 1 in the corresponding rows of Table 2.

The only idea I could formulate but not execute would be to somehow take the note number to the lines between the date of departure and the date of delivery of the vehicle with the same license plate in the 2 tables.

1 ACCEPTED SOLUTION
Community Support

@lbendlin , thank you for your interest in this situation. Allow me to provide an insight.
Create a calculated column.

``````Column =
CALCULATE(MAX('Table'[note]), 'Table'[license plate] = EARLIER('Table 2'[license plate]), 'Table'[start] <= EARLIER('Table 2'[DATE]. [Date]), 'Table'[end] >= EARLIER('Table 2'[DATE]. [Date]))``````

Best Regards,

Clara Gong

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

3 REPLIES 3
Community Support

@lbendlin , thank you for your interest in this situation. Allow me to provide an insight.
Create a calculated column.

``````Column =
CALCULATE(MAX('Table'[note]), 'Table'[license plate] = EARLIER('Table 2'[license plate]), 'Table'[start] <= EARLIER('Table 2'[DATE]. [Date]), 'Table'[end] >= EARLIER('Table 2'[DATE]. [Date]))``````

Best Regards,

Clara Gong

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

New Member

Thank you for the tips.

As instructed and following the models proposed by the community guide, I will represent my difficulty with usable tables.

Table 1 is constructed of a stratum of invoices for all vehicles in the year (each line being an invoice). In table 1 I have the information in a single line containing: "date of start of transport", "license plate", "date of end of transport" and "note number"

 Data de Emissão da NF Data de Chegada Notas Fiscais Veículo - Placa 02/01/2023 02/01/2023 022301 BPQ7E 02/01/2023 03/01/2023 022302 RRJ1E 04/01/2023 05/01/2023 022303 BPQ7E 04/01/2023 06/01/2023 022304 RRJ1E

Table 2 is an extract from a set of trackers. Containing the latitude and longitude of each vehicle on a minute-by-minute basis. Table 2 has the fields "date" and "time”, "plate", "latitude", "longitude" (This table is too big to include in its entirety (it has a line for each minute of each vehicle)

 DATA HORA PLACA LATITUDE LONGITUDE 02/01/2023 00:01 BPQ7E -22,568 15,568 02/01/2023 20:30 BPQ7E -22,568 15,568 02/01/2023 23:59 BPQ7E -22,568 15,568 03/01/2023 00:01 BPQ7E -22,568 15,568 03/01/2023 20:30 BPQ7E -22,568 15,568 03/01/2023 23:59 BPQ7E -22,568 15,568 02/01/2023 00:01 RRJ1E -22,568 15,568 02/01/2023 20:30 RRJ1E -22,568 15,568 02/01/2023 23:59 RRJ1E -22,568 15,568 03/01/2023 00:01 RRJ1E -22,568 15,568 03/01/2023 20:30 RRJ1E -22,568 15,568 03/01/2023 23:59 RRJ1E -22,568 15,568 04/01/2023 00:01 RRJ1E -22,568 15,568 04/01/2023 20:30 RRJ1E -22,568 15,568 04/01/2023 23:59 RRJ1E -22,568 15,568 05/01/2023 00:01 RRJ1E -22,568 15,568 05/01/2023 20:30 RRJ1E -22,568 15,568 05/01/2023 23:59 RRJ1E -22,568 15,568 06/01/2023 00:01 RRJ1E -22,568 15,568 06/01/2023 20:30 RRJ1E -22,568 15,568 06/01/2023 23:59 RRJ1E -22,568 15,568 04/01/2023 00:01 BPQ7E -22,568 15,568 04/01/2023 20:30 BPQ7E -22,568 15,568 04/01/2023 23:59 BPQ7E -22,568 15,568 05/01/2023 00:01 BPQ7E -22,568 15,568 05/01/2023 20:30 BPQ7E -22,568 15,568 05/01/2023 23:59 BPQ7E -22,568 15,568 06/01/2023 00:01 BPQ7E -22,568 15,568

To build my report, I need to put the note number from Table 1 in the corresponding rows of Table 2.The only idea I could formulate but not execute would be to somehow take the note number to the lines between the date of departure and the date of delivery of the vehicle with the same license plate in the 2 tables.
The table I hope to obtain would be loading the invoice number into table 2
Staying:

 DATA HORA PLACA LATITUDE LONGITUDE Notas Fiscais 02/01/2023 00:01 BPQ7E -22,568 15,568 22301 02/01/2023 20:30 BPQ7E -22,568 15,568 22301 02/01/2023 23:59 BPQ7E -22,568 15,568 22301 03/01/2023 00:01 BPQ7E -22,568 15,568 03/01/2023 20:30 BPQ7E -22,568 15,568 03/01/2023 23:59 BPQ7E -22,568 15,568 02/01/2023 00:01 RRJ1E -22,568 15,568 22302 02/01/2023 20:30 RRJ1E -22,568 15,568 22302 02/01/2023 23:59 RRJ1E -22,568 15,568 22302 03/01/2023 00:01 RRJ1E -22,568 15,568 22302 03/01/2023 20:30 RRJ1E -22,568 15,568 22302 03/01/2023 23:59 RRJ1E -22,568 15,568 22302 04/01/2023 00:01 RRJ1E -22,568 15,568 22304 04/01/2023 20:30 RRJ1E -22,568 15,568 22304 04/01/2023 23:59 RRJ1E -22,568 15,568 22304 05/01/2023 00:01 RRJ1E -22,568 15,568 22304 05/01/2023 20:30 RRJ1E -22,568 15,568 22304 05/01/2023 23:59 RRJ1E -22,568 15,568 22304 06/01/2023 00:01 RRJ1E -22,568 15,568 22304 06/01/2023 20:30 RRJ1E -22,568 15,568 22304 06/01/2023 23:59 RRJ1E -22,568 15,568 22304 04/01/2023 00:01 BPQ7E -22,568 15,568 22303 04/01/2023 20:30 BPQ7E -22,568 15,568 22303 04/01/2023 23:59 BPQ7E -22,568 15,568 22303 05/01/2023 00:01 BPQ7E -22,568 15,568 22303 05/01/2023 20:30 BPQ7E -22,568 15,568 22303 05/01/2023 23:59 BPQ7E -22,568 15,568 22303 06/01/2023 00:01 BPQ7E -22,568 15,568

Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors