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
bombom
Helper I
Helper I

Power BI merge one column from one table to another

Hello!

 

I have two tables. They are joined together by TicketId column already.

 

Table 1.

 

TicketIdStartTimeOfLoadingEndTimeOfLoading
13358015.11.2022 12:16:5915.11.2022 12:25:37

 

Table 2.

 

CreatedAtTicketIdStepResult
14.11.2022 13:02:561335802Successfull
14.11.2022 13:05:151335804Successfull
14.11.2022 13:05:291335808Error
14.11.2022 13:11:231335802Successfull
14.11.2022 13:13:381335804Successfull
14.11.2022 13:13:521335808Error
14.11.2022 13:24:031335802Successfull
14.11.2022 13:26:211335804Successfull
14.11.2022 13:26:351335808Error
15.11.2022 12:16:581335802Successfull
15.11.2022 12:19:281335804Successfull
15.11.2022 12:25:361335805Successfull
15.11.2022 12:25:371335806Successfull
15.11.2022 12:25:371335807Successfull

 

StartTimeOfLoading column from Table 1 is the date from Table 2 with the Step = 2 and maximum date from the CreatedAt column. The same for EndTimeOfLoading column, but it's Step = 7.

 

I need to merge Steps 4, 5, 6 with max date condition on column from Table 2 to Table 1.

 

TicketIdStartTimeOfLoadingEndTimeOfLoading456
13358015.11.2022 12:16:5915.11.2022 12:25:3715.11.2022 12:19:2815.11.2022 12:25:3615.11.2022 12:25:37
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @bombom ,

 

Here are the steps you can follow:

1. Create calculated column.

4 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=4&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])
5 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=5&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])
6 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=6&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])

2. Result:

vyangliumsft_0-1670290532538.png

 

Best Regards,

Liu Yang

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @bombom ,

 

Here are the steps you can follow:

1. Create calculated column.

4 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=4&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])
5 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=5&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])
6 =
MAXX(FILTER(ALL(Table2),
'Table2'[Step]=6&&'Table2'[TicketId]=EARLIER('Table1'[TicketId])),[CreatedAt])

2. Result:

vyangliumsft_0-1670290532538.png

 

Best Regards,

Liu Yang

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

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.