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

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.

Reply
NikkiSavage
Helper II
Helper II

Lookup for multiple values within 2 table

I have two separate tables. One has a list of customers with related incidents and the date (some listed multiple times for multiple incidents). 

I then have another table which states the movements of a customer on set dates including if they went to hospital. I need to do a look up in table 1 to say if a customer has had a fall and been to hospital within 2 days of that fall (looking up from table 2) to then return a positive value or "yes".

NikkiSavage_0-1623194099368.png

 

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hi @NikkiSavage , your easiest solution would to merge these two tables in power query.  If you would copy and paste your data into the message, rather than a picture, we could show you how to do that. 
If you would share your pbix, or dummy up some values in Excel both for current and expected data. Please copy and paste them into your post, rather than doing a picture, we may be able to help you, or provide a pbix. 

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Nathaniel_C
Super User
Super User

Hi @NikkiSavage , your easiest solution would to merge these two tables in power query.  If you would copy and paste your data into the message, rather than a picture, we could show you how to do that. 
If you would share your pbix, or dummy up some values in Excel both for current and expected data. Please copy and paste them into your post, rather than doing a picture, we may be able to help you, or provide a pbix. 

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi

 

I can't seem to copy and paste pictures - it's saying I'm not allowed and then saying there is errors as my data contains html issues.

@Nathaniel_C  this is the error I get...Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied. Will try and start a new query with the tables

Hi @NikkiSavage , below you will find the steps to creating this solution and the pictures detailing those steps.  I didn't know your level of using Power Query so this may be overly detailed.  If you would prefer a third table, so that you kept your two in their original form, in the merge step, choose to save as a new table. The way the pics loaded, start from the bottom.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

 

v1234567890.PNG

 

10. Final product

 

v123456789.PNG

9. Filter

 

v12345678.PNG

 

8. Added conditional column

 

v1234567.PNG

 

7.Added date col

 

v123456.PNG

 

6.Filtered Rows

 

v12345.PNG

 

5. Expanded columns

 

v1234.PNG

 4. Merged

 

 

v123.PNG

 

3.Filtered rows for Hosp

v12.PNG

 

2.Second table

v1.PNG

 1. First table





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.