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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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())
  

Follow on LinkedIn
@ 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())
  

Follow on LinkedIn
@ 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.