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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
kb26w
Frequent Visitor

Multiple dates in one table - lookup not working due to duplicates

Hi all, 

 

I am trying to do a look up to find the number of people who have ordered one product and then gone on to order another. 

 

I have a calculated table with a list of product A and a calculated table with a list of product B with the customer ID's in both table. 

 

However, when I use the LOOKUP function to lookup the order date from the product B table some customers have ordered more than once and therefore I have the error due to there being multiple values. 

 

When I create the table for product B, is there a way for me to add something in so that the table only shows one line per customer based on the latest purchase of product B which the customer made. 

 

Here is the dax I am using to create my product B table. 

 

Product B purchases = CALCULATETABLE (
SELECTCOLUMNS(Sales, "Customer ID",Sales[Customer ID],"Purchase Date", Sales[Purchase Date],"Customer Name", Sales[Customer Name],"Purchase Country", Sales[Country],"Purchase Price", Sales[Price]),
FILTER (
Sales,
Sales[Purchase Date] >= DATE(2020,03,01)
&& Sales[Purchase Date] <= DATE(2021,12,31)
&& NOT(ISBLANK(Sales[Customer ID]))
)
)

 

I am guessing I need to use the MAX function but I am not sure how or where to add it and if I need anything else such as GROUPBY. 

Many thanks

1 REPLY 1
Anonymous
Not applicable

Hi @kb26w ,

In order to get a better understanding for your requirement and give you a suitable solution, could you please provide the following necessary info? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

  • Some raw data in your tables (exclude sensitive data) with Text format
  • Your expected result with backend logic and special examples
  • What the calculated table Product A table and Product B table are used to get?  Both of them involve the fields from the table 'Sales'?

And it is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors