Forum Discussion

manoj619's avatar
manoj619
Regular Visitor
1 year ago

Power bi desktop

In Power BI, I need to create a display that shows only the values from Table B that are not present in Table A, based on the selected country from a dropdown filter

 

Table a

Car    Country

tata    india

tata    swiss

swift   pak

benz   swiss

swift   India

kia       pak

Byd.   Lanka

Byd    India

 

Table b

Brand year 

benz   2000

kia      2001

tata    2002

Volvo 2003

 

 

example:

 if i select pak in dropdown the output should be

Benz 2000

tata 2002

Volvo 2003

 

If i select india the output should be

benz 2000

Kia 2001

Volvo 2003

4 Replies

  • manoj619 

    Ensure that there is no direct relationship between Table A and Table B.

    Use the 'Country' column from Table A to create a dropdown filter.

    Create a new calculated table that will contain the brands from Table B that are not present in Table A for the selected country.

     

    DAX
    FilteredBrands =
    VAR SelectedCountry = SELECTEDVALUE('Table A'[Country])
    RETURN
    FILTER(
    'Table B',
    NOT 'Table B'[Brand] IN
    CALCULATETABLE(
    VALUES('Table A'[Car]),
    'Table A'[Country] = SelectedCountry
    )
    )

     

    Use a table visual to display the values from the FilteredBrands table.

    • manoj619's avatar
      manoj619
      Regular Visitor

      showing expression refers to multiple columns cannot be converted a scale value

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, manoj619 

     

    You can try the following methods.

    Measure = 
    VAR SelectedCountry = SELECTEDVALUE('Table a'[Country])
    Var  _table=
    FILTER( 'Table b',
    NOT 'Table B'[Brand] IN
    CALCULATETABLE( VALUES('Table a'[Car]),'Table a'[Country] = SelectedCountry))
    RETURN
    IF(SELECTEDVALUE('Table b'[Brand]) in _table,1,0)

    Is this the result you expected?

     

    Best Regards,

    Community Support Team _Charlotte

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

    • manoj619's avatar
      manoj619
      Regular Visitor

      i got error as the number of arguments is invalid. Function containsrow must have value for each column in the table expression