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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Replicating Vlookup in power bi

Basically I have two tables Sales and District and both tables contain a Username column but I cannot create a relationship between them as it would be a many to many relationship and other reasons in my real report.

Iver199_0-1645588766866.png

I want to get a district column on my Sales table so I would be able to get the sales per district. I could achieve this in Excel using vlookup. I tried using lookupvalue in power bi but was met with this error.

Iver199_1-1645588848239.png

What can I do in this situation to get the District column in my Sales table?

 

Here is the sample pbix

1 ACCEPTED SOLUTION

@Anonymous 

 

Sales is by username and for each username, there are multiple districts in a separate table. In order to relate sales of each user to a specific district you would need a key to join the 2 tables "Sales" and "District". This seems missing at the moment. 

 

Hope this helps.

 

Regards

Kumail Raza

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I have one question.

In Sales Table, when user name is 111, what District you want to see? 

Korea? US? Germany? Jakarta?

 

When I see in Dist Table, under the username 111, there are more than one District name.

 

If there is any other factor to look-up, for instance, 'date' or 'a range of the sales amount', please kindly advise.

 

Thanks.

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Anonymous
Not applicable

@Jihwan_Kim 

 

Sorry for not being clear. I'll just make my question as simple as possible. In this kind of situation how can I get the sales per district?

@Anonymous 

 

Sales is by username and for each username, there are multiple districts in a separate table. In order to relate sales of each user to a specific district you would need a key to join the 2 tables "Sales" and "District". This seems missing at the moment. 

 

Hope this helps.

 

Regards

Kumail Raza

@Anonymous 

 

Lookup value should return error because Dist username have multiple district with same username.

 

If you are looking to extract district from district table in sales table, then you can use FirstNonBlank.

Dist = 
CALCULATE(FIRSTNONBLANK(Dist[District], TRUE()), FILTER(Dist, Dist[Username] = Sales[Username]))

Kumail_0-1645619464269.png

https://drive.google.com/file/d/1rA3GjHmVUmeLjtILb4LerTTrqG9PYcRV/view?usp=sharing

 

Hope this helps!

 

Regards

Kumail Raza

Did this help? Kudos are appreciated!

Consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors