Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, would really appreciate some help with an unexpected LOOKUPVALUE issue!
I've got two tables, 'Users' that has [id] and [name] among other fields and it contains one entry per [id], and 'TimeEntries' that has [user_id] among other fields and it contains multiple time entries for the same [user_id]. I am trying to add a name column to the 'Time entries' table using the following forumula:
user_id | name |
1234 | Name Surname |
1234 | |
1234 | Name Surname |
1234 | Name Surname |
1234 |
Have you ever seen anything like this? Would really appreciate some help!
Hi, @MonikaR
Based on your description, I have tried several times and the result of the 'name' column displayed normally no matter what data type the userid is. You may try to use the following formula.
name = LOOKUPVALUE(Users[name],Users[id],TimeEntries[user_id],max(Users[name]))
Please inform me of the result. I am glad to solve the problem for you. Thanks.
Best Regards
Allan
Hi @v-alq-msft , thanks for your suggestion. I've tried the formula but it didn't work unfortunately.
The good news is that I have resolved the issue by changing my data model a bit and creating a relationship between 'Users' and 'TimeEntries' tables. Now LOOKUPVALUE (as well as RELATE) works as expected. It's still not clear to me why it was not the case before as I didn't think you needed a relationship for LOOKUPVALUE to function but there you go...
This is indeed unexpected behaviour, and I was immediately thinking about data types. Changing it to whole numbers in both tables should have solved that, but please try to do so in Power Query and not in PBI Desktop mode. This also removes trailing spaces in the numbers.
You might want to try this, it is actually the same (or should be the same, I think) but just to rule out everything:
name =
VAR _curUserID = TimeEntries[user_id]
RETURN
LOOKUPVALUE(Users[name],Users[id],_curUserID)
This makes sure that when this is evaluated as a column, it first retrieves the current user_id before evaluating anything else. This might solve some weird relationship filtering that might be going on. Could you let me know if this helped at all? (small chance but I do want to make certain :))
Thanks!
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @JarroVGIT, thanks for your reply! I've tried changing the formula code as you've suggested with the first var to retrieve user_id, however it didn't work.
Will try the data type change in Query tomorrow as the data takes a while to refresh and I've hit the wall with this thing today so heading home for now. Will post an update tomorrow re. how that goes.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |