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

new column with filtred information from other

HI, as allways sorry for my english :DDD

I need create new column for Table1 using information from Table2. I tried ALL function but it dosen't work correctly.

I have this information:

 

table1                                                                                               table2

 

ID     User ID            date                    table2 ID                                ID        Created_User ID    Company_ID       

5           10            2021.02.02                 2                                         2                      8                     55

6           10            2021.02.25                 2                                         3                      7                     63

7           8              2020.12.20                 2                                        

8           7              2021.01.11                 3

From table1 i want put information earlest date for all users to table 2 (thats mean I create new rows) rezults should be:

 ID        Created_User ID    Company_ID        USER_ID (new column)      Earlest date (new column)

2                   8                          55                             10                                             2021.02.02

?                   8                          55                               8                                              2020.12.20

3                   7                          63                               7                                             2021.01.11

I hope its not to confusing, i tried my best ;D

                                     

1 ACCEPTED SOLUTION
v-yuaj-msft
Community Support
Community Support

Hi @AndrejZevzikov ,

 

Based on your description, you can create a calculated table as follows.

 
Table =
VAR x1 =
CROSSJOIN ( ALLEXCEPT ( Table1, Table1[ID] ), 'Table2' )
VAR x2 =
FILTER (
x1,
[ID] = [table2 ID]
&& [date]
<= CALCULATE ( MIN ( 'Table1'[date] ), ALLEXCEPT ( Table1, Table1[User ID] ) )
)
RETURN
x2

 

Result:

v-yuaj-msft_0-1613971643153.png

 

Then you can rename the columns.

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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-yuaj-msft
Community Support
Community Support

Hi @AndrejZevzikov ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

 find a easiest way just 1) in power BI query conect two columns in table one and two (User_ID&Table2_ID and Created_User_ID&ID) 2) Sort table1 by new column and date and when just remove dublicates bay new column in table1. 3)When just merge tables.

v-yuaj-msft
Community Support
Community Support

Hi @AndrejZevzikov ,

 

Based on your description, you can create a calculated table as follows.

 
Table =
VAR x1 =
CROSSJOIN ( ALLEXCEPT ( Table1, Table1[ID] ), 'Table2' )
VAR x2 =
FILTER (
x1,
[ID] = [table2 ID]
&& [date]
<= CALCULATE ( MIN ( 'Table1'[date] ), ALLEXCEPT ( Table1, Table1[User ID] ) )
)
RETURN
x2

 

Result:

v-yuaj-msft_0-1613971643153.png

 

Then you can rename the columns.

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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.