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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
tim_001
Helper I
Helper I

DAX VLOOKUP custom column with duplicate values and blanks

Hi, 

 

I have pretty much the same issues as I found in this post

 

hi all,

 

i am new to PowerBI and am facing an issue, any comments or help is much appreciated.

 

i have 2 tables at the moment, table 1 and table 2 which looks like this:

 

Table1

type 1 , apple

type 1, apple

type 2, cheese

type 3, bake

type 3, bake

 

Table2

type 1 , chef1

type 1, chef2

type 2, cook

type 3, helper1

type 3, helper2

 

what i would like to achieve is below:

Table1

type 1 , apple , chef1

type 1, apple , chef1

type 2, cheese , cook

type 3, bake , helper1

type 3, bake, helper1

 

basically a 'vlookup' from table1 to table2 taking only the first value.

 

i have tried LOOKUPVALUE but it returns an error of 'multiple values was supplied where a single value was expected'

 

So I followed the accepted solution: 

 

Try a new column in table 1

 

minx(filter(Table2, Table1[type] = Table2[Type] ) , Table2[Value] )

 

But whenever there is both a blank cell and a full cell under Table2[Value], it returns the blank cell instead of the full cell. 

 

--> Is there any way to tweak this formula to return the cell with data instead of blank if both are available with same filter?

 

Any help is much appreciated 🙂 

 

BR
Tim

1 ACCEPTED SOLUTION
Royel
Super User
Super User

Hi @tim_001  you can try this one. Select your Table1 and create a calculated column  

Chef = 
VAR CurrentType = Table1[Type]
RETURN
CALCULATE(
    FIRSTNONBLANK(Table2[Item], Table2[Item]),
    FILTER(
        Table2, 
        Table2[Type] = CurrentType && 
        NOT(ISBLANK(Table2[Item])) &&
        Table2[Item] <> ""
    )
)

 

Results:

Royel_0-1756158814574.png

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

 

View solution in original post

6 REPLIES 6
Shahid12523
Community Champion
Community Champion

Use this instead of your formula to ignore blanks:

 

NewColumn =
MINX (
FILTER (
Table2,
Table2[Type] = Table1[Type]
&& NOT ISBLANK ( Table2[Value] )
),
Table2[Value]
)


👉 This skips blanks and returns the first non-blank (lowest alphabetically).

If you just want any non-blank:

 

NewColumn =
FIRSTNONBLANK (
FILTER ( Table2, Table2[Type] = Table1[Type] ),
Table2[Value]
)

Shahed Shaikh
Royel
Super User
Super User

Hi @tim_001  you can try this one. Select your Table1 and create a calculated column  

Chef = 
VAR CurrentType = Table1[Type]
RETURN
CALCULATE(
    FIRSTNONBLANK(Table2[Item], Table2[Item]),
    FILTER(
        Table2, 
        Table2[Type] = CurrentType && 
        NOT(ISBLANK(Table2[Item])) &&
        Table2[Item] <> ""
    )
)

 

Results:

Royel_0-1756158814574.png

 

Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!

 

tim_001
Helper I
Helper I

Hi @rajendraongole1  - thanks for the fast reply - much appreciated 🙂

 

I tried above, but it still returns a blank - maybe updated table below for clarifaction: 

 

Table1

type 1 , apple

type 1, apple

type 2, cheese

type 3, bake

type 3, bake

 

Table2

type 1 , 

type 1, chef1

type 1, chef1

type 2, cook

 

 

what i would like to achieve is below:

Table1

type 1 , apple , chef1

type 1, apple , chef1

type 2, cheese , cook

 

..> Right now it returns blank to me instead of chef1

you can try the below logic, still any please find the attached pbix.

Chef_2 =
MINX (
    FILTER (
        Table2,
        Table2[Type] = Table1[Type] &&
        NOT (
            ISBLANK ( Table2[Value] ) || Table2[Value] = ""
        )
    ),
    Table2[Value]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,

This calculated column formula in Table1 works

Column = CALCULATE(MIN(Table2[Fruit]),FILTER(Table2,Table2[Type]=EARLIER(Table1[Type])&&Table2[Fruit]<>BLANK()))

Hope this helps.

Ashish_Mathur_0-1756177438257.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rajendraongole1
Super User
Super User

Hi @tim_001  - you can create a calculated column as like below:

 

Chef =
MINX (
    FILTER (
        Table2,
        Table2[Type] = Table1[Type] &&
        NOT ISBLANK ( Table2[Value] )
    ),
    Table2[Value]
)

 

rajendraongole1_0-1756141923986.png

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.