Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Antmkjr
Helper V
Helper V

Lookup a table after filtering certain values in the table

CountrySalesRankContinentSl
India1003Asia1
Pakistan503Asia2
France951Europe4
China903Asia3
India894NULL1

 

I have a Table A as shown above, and Table B as below:

 

CountrySlSales
India1#ERROR
Pakistan2#ERROR
China3#ERROR

 

Im looking up Sales from Table A in Table B, However I want to lookup Table A excluding Continent = NULL,

How to frame the DAX for lookup by excluding the mentioned row from table A.

AnuTomy_0-1653675441096.png

 

1 ACCEPTED SOLUTION

Hi @Antmkjr,

 

You could change the data type of the Measure by Column tools.

vcazhengmsft_0-1654052628048.png

 

Or make a little bit change to the Measure itself.

LookUpSales =
var res=SUMX (
    FILTER (
        'Table A',
        'Table A'[Country] = 'Table B'[Country]
            && 'Table A'[Continent] <> "NULL"
            && 'Table A'[Sl] = 'Table B'[Sl]
    ),
    'Table A'[Sales]
)
return CONVERT(res,STRING)

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

5 REPLIES 5
v-cazheng-msft
Community Support
Community Support

Hi @Antmkjr,

 

You need make some changes to your Calculated column formula.

LookUpSales =
SUMX (
    FILTER (
        'Table A',
        'Table A'[Country] = 'Table B'[Country]
            && 'Table A'[Continent] <> "NULL"
            && 'Table A'[Sl] = 'Table B'[Sl]
    ),
    'Table A'[Sales]
)

 

Then, the result looks like this.

vcazhengmsft_0-1653975629208.png

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

In this case its fine, but what if the value i have to return is text

Hi @Antmkjr,

 

You could change the data type of the Measure by Column tools.

vcazhengmsft_0-1654052628048.png

 

Or make a little bit change to the Measure itself.

LookUpSales =
var res=SUMX (
    FILTER (
        'Table A',
        'Table A'[Country] = 'Table B'[Country]
            && 'Table A'[Continent] <> "NULL"
            && 'Table A'[Sl] = 'Table B'[Sl]
    ),
    'Table A'[Sales]
)
return CONVERT(res,STRING)

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

amitchandak
Super User
Super User

@Antmkjr , a New column in Table B

 

Sumx(filter( 'Table A', 'Table A'[Country] = 'Table b'[Country] ), 'Table A'[Sales])

 

or

 

 

Sumx(filter( 'Table A', 'Table A'[Country] = 'Table b'[Country] && 'Table A'[sl] = 'Table b'[sl] ), 'Table A'[Sales])

AnuTomy_0-1653743791291.png

In this case of both of these its Summing up the sales of India where Continent = NULL , i want to completely ignore that record      

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors