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
vnqt
Helper V
Helper V

Pull data from unrelated table based on 2 columns

Hi,

I have 2 tables 

Table Product: 

NameTag
Name 1Tag 1
Name 2Tag 2
Name 3Tag 3
Name 4Tag 4
Name 5Tag 5
Name 6Tag 6
Name 7Tag 7
Name 8Tag 8
Name 9Tag 9
Name 10

Tag 10

 

Table Support 

NameTagSLA
Name 1Tag 15/7
Name 22Tag 25/7
Name 33Tag 37/7I
Name 44Tag 47/7I
Name 5Tag 55/7
Name 6Tag 65/7
Name 7Tag 77/7I
Name 8Tag 87/7I
Name 9Tag 97/7R
Name 10Tag 107/7R

 

I would like to pull the column Support[SLA] to table product with condition: Product[Name] = Support[Name], if  Product[Name] <> Support[Name] then Product[Tag] = Support[Tag]

Could you please help?

 

Many thanks in advance.

Tg 

 

2 ACCEPTED SOLUTIONS
ThxAlot
Super User
Super User

ThxAlot_0-1705930264582.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

@vnqt 

sorry . my mistake . 

let me correct the code : 

maxx(

filter(

support_table, 

support_table[name] = product_table[name] || support_table[tag] = product_table[tag]

) ,

support_table[sla]

)

 

you need to just add the support_table[sla] 

you can also use @ThxAlot  dax . it works also . 

 

View solution in original post

8 REPLIES 8
ThxAlot
Super User
Super User

ThxAlot_0-1705930264582.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Daniel29195
Super User
Super User

@vnqt hello ,

try this code and tell me it works  for you . 

 

 

new_table =
VAR datasource1 =
    SELECTCOLUMNS(
        'product',
        "product_name", product[Name],
        "product_tag", product[tag]
    )

VAR datasource2 =
    SELECTCOLUMNS (
        'support',
        "support_name", 'support'[Name],
        "support_tag", 'support'[tag],
        "sla", 'support'[SLA]
    )

VAR crossing_tables =  
    CROSSJOIN( datasource1 , datasource2 )

VAR result =
    FILTER (
        crossing_tables ,
        [product_name] = [support_name] || [product_tag] = [support_tag]
    )

RETURN result
 
 
 
If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍

Thank you @Daniel29195 

 

Your solution works but I would like to add the column SLA to the table Product (DAX or PowerQuery) . Do you have any suggestion ? Thank you.

 

you can use dax : 

 

create a calculated column in product table as follow : 

 

maxx(

filter(

support_table, 

support_table[name] = product_table[name] || support_table[tag] = product_table[tag]

)

)

 

can you try this caclulated column, and tell me if it works .

 

best regards, 

hi, 

I got this error "The syntax for "VDI" is incorrect."

 

Kind regards,

Tg

@vnqt  can you please share w screenshot of the dax you wrote + the error you are having. 

@Daniel29195 

 

vnqt_0-1705931262552.png

Too few arguments were passed to the MAXX function. The minimum number of function arguments is 2.

 

@vnqt 

sorry . my mistake . 

let me correct the code : 

maxx(

filter(

support_table, 

support_table[name] = product_table[name] || support_table[tag] = product_table[tag]

) ,

support_table[sla]

)

 

you need to just add the support_table[sla] 

you can also use @ThxAlot  dax . it works also . 

 

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.