Search code examples
powerbidaxpowerbi-desktop

Get value from another table Power BI


I have two tables like -

Table A -

Seller Value Crawl_date
Mat 2 28-Aril-2023
Harry 32 28-Aril-2023
cat 0 28-Aril-2023
Jon 28-Aril-2023
Sohan 121 28-Aril-2023
Ray 3223 28-Aril-2023
Mat 2 26-Aril-2023
Harry 32 26-Aril-2023
cat 0 26-Aril-2023
Jon 26-Aril-2023
Sohan 121 26-Aril-2023
Ray 3223 26-Aril-2023

Table B-

Seller
Mat
Harry
cat
Jon
Om

My expected output would be, to create a new column for table B called "check" and assign True or 1 if the same seller is in A and if its value is greater than 0 and it should be based on the latest crawl date.

Table B -

Seller Check
Mat True
Harry True
cat False
Jon False
Om False

Solution

  • UPDATED REQUIREMENTS

    Check = 
    VAR x = SELECTCOLUMNS( TOPN(1, FILTER('Table A', 'Table A'[Seller] = 'Table B'[Seller]), CALCULATE(MAX('Table A'[Crawl_date])), DESC) ,"@y", 'Table A'[Value])
    RETURN IF(x > 0 , TRUE(), FALSE())
    

    Add a calculated column as follows:

    Check = 
    VAR x = LOOKUPVALUE('Table A'[Value], 'Table A'[Seller], 'Table B'[Seller])
    RETURN IF(x > 0 , TRUE(), FALSE())
    

    enter image description here