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
Pratiksha1
New Member

Replicating the functionality of XLOOKUP in PowerBI with IF Condition

Hi all, 

I am new to PowerBI and I am facing a challenge with replicating the Excel XLOOKUP function combined with an IF statement in PowerBI. This is what my data looks like - 

Pratiksha1_0-1656412720545.png


Now I have tried to create the Phase_Match column using the formula 

Phase_Match = IF(Sheet1[Issue_Type] = "CO Deliverable", IF(CONTAINS(Sheet1,Sheet1[Issue_Key],[Parent_Link]) = TRUE(),Sheet1[Milestone_Phases],"NO MILESTONE MATCH"),Sheet1[Milestone_Phases])

This is looking up and fetching values but it is not quite replicating the XLOOKUP functionality. I want it to lookup Parent_Link in Issue_Type and fetch the corresponding Milestone_Phase where it gets the first lookup match. This is what I want it to give me - 

Pratiksha1_1-1656412935830.png


I have tried using LOOKUPVALUE but it keeps throwing the error - "A table of multiple values was supplied where a single value was expected." I tried this - LOOKUPVALUE(Sheet1[Milestone_Phases],Sheet1[Issue_Key],[Parent_Link])

I have also tried Merge Queries in Power Query but I'm not sure how to combine that with my IF condition.

Any help on this will be greatly appreciated. Thanks in advance!



1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Pratiksha1 ,

According to your description, the overall logic of your formula is correct, but the highlight part will always return the Milestone_Phased in the current row instead of the first correponding row as your expected.

vkalyjmsft_0-1656643840813.png

Here's my solution,

1.In Power Query, add an index column.

vkalyjmsft_1-1656644074223.png

2.Create a calculated column.

Phase_Match =
IF (
    Sheet1[Issue_Type] = "CO Deliverable",
    IF (
        CONTAINS ( Sheet1, Sheet1[Issue_Key], [Parent_Link] ) = TRUE (),
        VAR _Index =
            MINX (
                FILTER ( 'Sheet1', 'Sheet1'[Issue_Key] = EARLIER ( 'Sheet1'[Parent_Link] ) ),
                'Sheet1'[Index]
            )
        RETURN
            MINX (
                FILTER ( 'Sheet1', 'Sheet1'[Index] = _Index ),
                'Sheet1'[Milestone_Phases]
            ),
        "NO MILESTONE MATCH"
    ),
    Sheet1[Milestone_Phases]
)

Get the correct result.

vkalyjmsft_2-1656644138172.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Pratiksha1 ,

According to your description, the overall logic of your formula is correct, but the highlight part will always return the Milestone_Phased in the current row instead of the first correponding row as your expected.

vkalyjmsft_0-1656643840813.png

Here's my solution,

1.In Power Query, add an index column.

vkalyjmsft_1-1656644074223.png

2.Create a calculated column.

Phase_Match =
IF (
    Sheet1[Issue_Type] = "CO Deliverable",
    IF (
        CONTAINS ( Sheet1, Sheet1[Issue_Key], [Parent_Link] ) = TRUE (),
        VAR _Index =
            MINX (
                FILTER ( 'Sheet1', 'Sheet1'[Issue_Key] = EARLIER ( 'Sheet1'[Parent_Link] ) ),
                'Sheet1'[Index]
            )
        RETURN
            MINX (
                FILTER ( 'Sheet1', 'Sheet1'[Index] = _Index ),
                'Sheet1'[Milestone_Phases]
            ),
        "NO MILESTONE MATCH"
    ),
    Sheet1[Milestone_Phases]
)

Get the correct result.

vkalyjmsft_2-1656644138172.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Hi @v-yanjiang-msft ,

It worked perfectly! Thanks a bunch!

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