Forum Discussion

KieuVuong's avatar
KieuVuong
Frequent Visitor
3 years ago
Solved

Lookup Value with 2 matched criteria

Hi guys, 

I am newbie in power BI, finding the way to use DAX and I have two table as pictures below

 

Product Table

 

Campaign Table

 

Question is: in the first table, I would like to have one new column named "Campaign" and

- for Article 10, the content of new column would be adidas_female (which matches one campaign in the Campaign Table)

- for Articles 11: Nike_kids

- for articles 12: Null ( as we dont have campaign micheal kors in kids in Campaign Table)

- for articles 13: Nike_kids

- for articles 14: adidas_female

- for articles 15: Null (as we dont have campaign Guess for female)

 

Could you please instruct me on that? Thank you a lot in advance!!

 

  • KieuVuong's avatar
    KieuVuong
    3 years ago

    Bifinity_75 Thank a lot for your help.

     

    But this code only matches the Brand, doesnt matches the Gender.

     

    For example, for article 10, it shows adidas_kids (which is not correct), it should be adidas_female.

     

    However, I try to learn your logic and code, I change it to:

     

    Result1 =

     maxx(filter('Campaign Table' , search('Product Table'[Brands] & "_" &'Product Table'[Gender], 'Campaign Table'[Campaign],,0)>0),'Campaign Table'[Brand] & "_" & 'Campaign Table'[Gender])
     
    The result is:
     

    Thank you so much!

     

2 Replies

  • Hi KieuVuong , create this calculate column:

    Result= 
    maxx(filter('Campaign Table' , search('Campaign Table'[Brand],'Product Table'[Brands],,0)>0),'Campaign Table'[Brand] & "_" & 'Campaign Table'[Gender])

     

    - The result:

     

    Best Regards

    • KieuVuong's avatar
      KieuVuong
      Frequent Visitor

      Bifinity_75 Thank a lot for your help.

       

      But this code only matches the Brand, doesnt matches the Gender.

       

      For example, for article 10, it shows adidas_kids (which is not correct), it should be adidas_female.

       

      However, I try to learn your logic and code, I change it to:

       

      Result1 =

       maxx(filter('Campaign Table' , search('Product Table'[Brands] & "_" &'Product Table'[Gender], 'Campaign Table'[Campaign],,0)>0),'Campaign Table'[Brand] & "_" & 'Campaign Table'[Gender])
       
      The result is:
       

      Thank you so much!