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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bjefko
Regular Visitor

Need to find matches for specific values

Hello,

I have data which is basically a customer, and a sku/price in a list.  Customer A and Customer B typically match each other's prices, but I need to see what other customers are matching their prices individually.  So Customer A is at $XX, what other customers (besides Customer B) are at that same price?  I want to return not just the count, but the actual names of the customers and the sku/price info.  Additionally, I want to say that XX% of Customer A's skus have matching Customers.  Below is how the data looks.

CustomerSkuPrice
Customer A123 $20
Customer A456 $10
Customer A789 $15
Customer A059 $10
Customer B123 $20
Customer B456 $15
Customer B059 $10
Customer W123 $20
Customer W789 $15
Customer X123 $20
Customer X789 $15
Customer Y456 $10
Customer Y123 $20
Customer Z456 $10

 

Here is how I'd like to show the matches... Note that I only need to fine the matches for Customer A and Customer B, it's not neccesary to see how many people are matching the other Customers.  Although, if that's easier it could be beneficial too.

CustomerSkuPriceMatches
Customer A123 $203
Customer A456 $102
Customer A789 $151
Customer A059 $100
   
Customer B123 $203
Customer B456 $152
Customer B059 $100
   
Customer W123 $20null
Customer W789 $15null
Customer X123 $20null
Customer X789 $15null
Customer Y456 $10null
Customer Y123 $20null
Customer Z456 $10null

 

And lastly, since there are matches for 3 out of 4 of Customer A's skus and 2 out of 3 of Customer B's skus, I'd like to eventually have the below type of measure.

Customer% w/ Match
Customer A75%
Customer B66%

 

I've tried a lot of different ways to slice the data and pivot/unpivot and such, but cannot find a clean way to do this or find a similar enough question.  Much obliged for any direction here. 

 

Thanks!

1 REPLY 1
Anonymous
Not applicable

@bjefko - Give these Measures a try: Note that they are matching the entire sku/price column, so if the price is not a match they're not considered a match. If you want to match only based on SKU and not price, you'll need to split the column into 2.

Other Customers With Sku Price = 
var sku_price = MAX(CustomerPrice[SkuPrice])
var cust = MAX(CustomerPrice[Customer])
var other_cust = SWITCH(
    TRUE(),
    cust = "Customer A","Customer B",
    cust = "Customer B","Customer A",
    "Customer Non-Exist"
)
return CALCULATE(
    COUNTROWS(CustomerPrice),
    CustomerPrice[SkuPrice] = sku_price,
    not CustomerPrice[Customer]  in {cust, other_cust}
) + 0

 

Percent of SKUs With Match = 
var _sum = SUMMARIZE(
    CustomerPrice,
    CustomerPrice[Customer],
    CustomerPrice[SkuPrice],
    "FoundCust", ([Other Customers With Sku Price] > 0)
)
return DIVIDE(
    CALCULATE(
        COUNTROWS(
            FILTER(_sum, [FoundCust] = TRUE())
        )
    ),
    COUNTROWS(_sum)
)
I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.