Search code examples
powerbidaxpowerbi-desktop

Get value from another table in Power BI


I have two tables A and B. I would like to fetch the value from Table B for each unique date for Table A.

As an example Suppose Below is the Table A. For the same Crawl_date it is having multiple data.

Crawl_date Seller A
1/12/2022 Hari
1/12/2022 Om
1/12/2022 Harry
1/15/2022 Harry
1/15/2022 Mat
1/17/2022 Kat
1/17/2022 Will

Table B --

Crawl_date Value B
1/12/2022 1
1/13/2022 2
1/14/2022 3
1/15/2022 4
1/16/2022 55
1/17/2022 66
1/18/2022 77

My Expectations are --

Crawl_date Value B
1/12/2022 1
1/15/2022 4
1/17/2022 66

For each unique date in Table A, I would like to fetch the corresponding data from Table B.


Solution

  • Add a calculated table:

    New Table = 
    ADDCOLUMNS(
        SUMMARIZE('Table A', 'Table A'[Crawl_date]),
        "Value B", 
        VAR a = CALCULATE(MIN('Table A'[Crawl_date])) 
        RETURN CALCULATE(MIN('Table B'[Value B]), 'Table B'[Crawl_date] = a)
    )