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
IvanS
Helper V
Helper V

LOOKUPVALUE not working without relationship

Hi guys,

 

I would need your help with LOOKUPVALUE function. I have pretty complex model so I cannot have active relationships between tables DIM_Products and DIM_Locations.

This is how the tables look:

DIM_Products

- Product ID

- Location ID

 

DIM_Locations

- Location ID

- Location Name

 

I need to populate Location Name into DIM_Products table. I tried to duplicate table and create new DIM_Location to Product and create relationships - then both RELATED and LOOKUPVALUE functions worked well.

LOOKUPVALUE('DIM_Locations to Products'[Location Name], 'DIM_Locations to Products'[Location_Id], DIM_Products[Location_Id])
RELATED('DIM_Locations to Products'[Location Name])

 

Due to size of model, I cannot accept to create such dummy tables, and therefore I removed duplicated table and remove relationship (respectively to keep inactive relationship) and rewrite the function as:

LOOKUPVALUE('DIM_Locations'[Location Name], 'DIM_Locations'[Location_Id], DIM_Products[Location_Id])

 

However this function is retrieving blanks values. As far as I know, LOOKUPVALUE does not require to have relationship between tables - any ideas what can be the root cause here?

 

Thank you
IvanS

 

1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

Are the id columns the same data type in both tables?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

4 REPLIES 4
bcdobbs
Super User
Super User

Are the id columns the same data type in both tables?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Thanks a lot! The I change type to number and then back to text and suddenly it is working! 🙂

speedramps
Super User
Super User

Hi Ivan

 

Your data model is wrong

Dimension should not be referencing Dimension

 

Try this classic star schema ...

 

DIM_Products

- Product ID

- Product Name
- Product Category

- Product Brand

 

DIM_Locations

- Location ID

- Location Name
- Location Country


Fact_Stock

- Product ID

- Location ID

- Qty


Then addrelationships

DIM_Products[Product ID] 1:M Fact_Stock[Product ID]
DIM_Locations[Location ID] 1:M Fact_Stock[Location ID]

 

Thanks for reaching out for help.

I put in a lot of effort to help you, now please quickly help me by giving kudos.

Remeber we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

Hi @speedramps ,

 

this model is pretty complicated as I have FACT_Tasks with "RelatedToID" field. And under this field it can be DIM_Locations, DIM_Deals and DIM_Products. And all of the DIM tables have Location name. And I need to get that into FACT_Tasks.

 

However, the question is still why LOOKUPVALUE is not able to find matching location without having active relationship.

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.