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
leilei787
Helper II
Helper II

Question about lookup function in PBI

Hi everyone, i have a question about lookup in PBI, please help

 

i am working on a PBI project related to customer product penetration. 

 

Below are three tables.

The first table represents customers who purchased our products. (it has duplicated customer ID because they purchased in different date).

The 2nd table represents what we believe total addressable market is for each customer. 

The 3rd table is what i want to see ( end result)

 

i want the total addressable market to be on the 1st table. however, because it has duplicated customer ID, my lookupvalue formula will make duplicated total addressable market numbers.  i can do average or minimal, but i wonder if there are other options.

1st table

Customer IDOrder DatePurchase Qty
11/1/202118
11/15/20215
23/4/202112
24/5/202122
35/6/202116
31/2/20215
45/7/202112
49/4/20219
58/1/20215
55/8/20217

 

The 2nd table

Customer IDTotal Addressable market
1200
2400
3300
4323
5233

 

End Result

Customer IDOrder DatePurchase QtyTotal Addressable market
11/1/202118200
11/15/20215 
23/4/202112400
24/5/202122 
35/6/202116300
31/2/20215 
45/7/202112323
49/4/20219 
58/1/20215233
55/8/20217 
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@leilei787 Try something like this:

Total Addressable market column = 
  VAR __Customer = [Customer ID]
  VAR __Date = [Order Date]
  VAR __MinDate = MINX(FILTER('1st Table',[Customer ID] = __Customer),[Order Date])
RETURN
  IF(__Date = __MinDate,MAXX(FILTER('2nd Table',[Customer ID] = __Customer),[Total Addressable market]),BLANK())
  

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@leilei787 Try something like this:

Total Addressable market column = 
  VAR __Customer = [Customer ID]
  VAR __Date = [Order Date]
  VAR __MinDate = MINX(FILTER('1st Table',[Customer ID] = __Customer),[Order Date])
RETURN
  IF(__Date = __MinDate,MAXX(FILTER('2nd Table',[Customer ID] = __Customer),[Total Addressable market]),BLANK())
  

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors