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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Vijay08V
Helper III
Helper III

Lookup Rating based on Filter Condition

Hi,

 

I am trying to replicate an excel formula in Power Bi. I have two tables A and B. In table A I have weightage values and I have ranked it within each category. In Table B I have the rankings and its corresponding ratings for each category. I am trying a DAX logic that checks if Category of table A matches with table B and then lookup the rating for the rankings. Anyhelp would be appreciated. Thanks!

Excel calculation :
=IF($AB7=0,"Doesnot",LOOKUP(AC7,$AI$2:$AI$5,$AF$2:$AF$5))

 

Vijay08V_1-1721162376785.png


Table A sample :

CategoryWeightage %RankingExpected Output
AB108.66%2Doesnot
AB117.29%1Meet
AC109.18%2Doesnot
AC111.44%1Meet

 

Table B Sample :

 

CategoryRatingRank
ABDoesnot2
ABExceed1
ABFar Exceed1
ABMeet1
ACDoesnot2
ACExceed1
ACFar Exceed1
ACMeet1
8 REPLIES 8
Vijay08V
Helper III
Helper III

Apologies made correction to expected output of Table A Category Weightage % Ranking Expected Output AB 108.66% 2 Doesnot AB 117.29% 1 Meet AC 109.18% 2 Doesnot AC 111.44% 1 Meet

CategoryWeightage %RankingExpected Output
AB108.66%2Doesnot
AB117.29%1Meet
AC109.18%2Doesnot
AC111.44%1Meet
Anonymous
Not applicable

Hi,@Vijay08V 

Regarding the issue you raised, my solution is as follows:

1.Create calculated column references:

way1 = 
IF (
    ISERROR (
        LOOKUPVALUE (
            'Table B'[Rating],
            'Table B'[Category], 'Table A'[Category],
            'Table B'[Rank], 'Table A'[Ranking]
        )
    ),
    "Meet",
    LOOKUPVALUE (
        'Table B'[Rating],
        'Table B'[Category], 'Table A'[Category],
        'Table B'[Rank], 'Table A'[Ranking]
    )
)
way2 = 
VAR ccate = 'Table A'[Category]
VAR crank = 'Table A'[Ranking]
RETURN
    MAXX (
        FILTER ( 'Table B', 'Table B'[Category] = ccate && 'Table B'[Rank] = crank ),
        'Table B'[Rating]
    )

2. Below are the measure I've created for your needs:

MEASURE = 
MAXX (
    FILTER (
        'Table B',
        'Table B'[Category] = MAX ( 'Table A'[Category] )
            && 'Table B'[Rank] = MAX ( 'Table A'[Ranking] )
    ),
    'Table B'[Rating]
)

 

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_0-1721203605308.png

 

 

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

Hi @Anonymous  - I added somemore data and tried the DAX logic  which you had shared in a calculated column but in some records I was getting blanks. 

I am not able to attach the PBIX file here so I have added it in a google drive. Basically I am trying to lookup Ratings from Table  B based on the Lookupvalue column and Ranking column.

Share drive URL
https://drive.google.com/file/d/1PsMn-xrYEWwnAKsgrSJo_ZrRVilkeIUG/view?usp=sharing

Table A :

Vijay08V_0-1721219882177.png

 

Table B :

Vijay08V_1-1721219904973.png

 

Anonymous
Not applicable

Hi,@Vijay08V 

Thanks for the quick reply.

The reason why the previous result is null is because the same values as the category and rank columns in Table A are not queried in Table B, so the return is empty.

At the moment I have fixed it according to your needs, added a judgment condition, and if it returns empty, it returns "Blank"

I offer two options:
 

1.Create calculated column references:

Column = 
VAR ccate = 'Table A'[Category]
VAR crank = 'Table A'[Ranking]
var mm1=    MAXX (
        FILTER ( 'Table B', 'Table B'[Category] = ccate && 'Table B'[Rank] = crank ),
        'Table B'[Rating]
    )
RETURN IF(ISBLANK(mm1),"BLANK",mm1)

2. Below are the measure I've created for your needs:

Measure = 
VAR mm2=MAXX (
    FILTER (
        'Table B',
        'Table B'[Category] = MAX ( 'Table A'[Category] )
            && 'Table B'[Rank] = MAX ( 'Table A'[Ranking] )
    ),
    'Table B'[Rating]
)
RETURN IF(ISBLANK(mm2),"BLANK",mm2)

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_0-1721269487442.png

 

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

Hi @Anonymous  - Appreciate your response. Actually there shouldn't be any blanks in the ratings. I have added the sample excel data with sample calculation.  In the sample calculation tab I have tried to perform the lookup calculation for each subset of data. I am trying to replicate the same logic in power Bi but with the consolidated data based on Lookupvalue column field. I hope the attached excel data brings more clarity to my problem statement.

Sample data link :

 

https://docs.google.com/spreadsheets/d/1YL68pUOK4EVzHtxy1tjV_8mqRy-3lR_g/edit?usp=sharing&ouid=111591468610839431407&rtpof=true&sd=true

Anonymous
Not applicable

Hi,@Vijay08V 

Has the problem been solved? If it does, share your solution and accept it as a solution that will help other community members who have the same problem as you.

If not, can you share it in a different way? Due to our security policy, we do not have access to the data you provide at this time, so we recommend that you choose to use SharePoint or OneDrive.

vlinyulumsft_0-1721639582324.png

 

Best Regards,

Leroy Lu

Hi @Anonymous  - I have put sample data and sample calculation in Onedrive

Lookup.xlsx

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors