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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
RafaelPatrignan
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"

 

RafaelPatrignan_1-1712956155475.png

 

 


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"

 

RafaelPatrignan_0-1712955838354.png

 



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
v-kaiyue-msft
Community Support
Community Support

Hi @RafaelPatrignan ,

@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]))

vkaiyuemsft_0-1713431933324.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

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.

View solution in original post

3 REPLIES 3
v-kaiyue-msft
Community Support
Community Support

Hi @RafaelPatrignan ,

@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]))

vkaiyuemsft_0-1713431933324.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

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.

RafaelPatrignan
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

 

 

lbendlin
Super User
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.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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