Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How do I do a VLOOKUP in PBI

The below is my example. I have a list of items that are either stock or not, and some of them have an alternative number. For those that do have an alternative, I want to check if the alternative is a stock item. In measure "Is Item stock?"

 

The below is the formula I have but is not working: 

 

Is_Alternative_Item_Stock_  = LOOKUPVALUE (
    'Item'[Item Is stock],
    'Item'[Item Number],
    'Item'[Item Alternative Number],
    0
)

 

Item NumberItem Is stock Product NameItem has replacementItem Alternative NumberIs Item stock?
1234YesOrange Yes5263 
1235NoAppleNo1893 

I've seen code where I can create a table in the measure section but I can't find it, appreciate your help !

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    If you were creating a measure. You can create as

    Is_Alternative_Item_Stock_ = LOOKUPVALUE('Item'[Item Is stock],'Item'[Item Number],SUM('Item'[Item Alternative Number]))

    Here's the result:

     

    You can download my attachment for more details.

     

     

    Best Regards,

    Stephen Tao

     

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you for your answer, I think I need to edit my question, I found it over the weekend that the correct statement is how to do a self join, since the measure is in the same table, could you help with this?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    If you were creating a measure. You can create as

    Is_Alternative_Item_Stock_ = LOOKUPVALUE('Item'[Item Is stock],'Item'[Item Number],SUM('Item'[Item Alternative Number]))

    Here's the result:

     

    You can download my attachment for more details.

     

     

    Best Regards,

    Stephen Tao

     

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