Forum Discussion

leilei787's avatar
leilei787
Helper II
4 years ago
Solved

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

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

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