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
rigelng1995
Frequent Visitor

Total number of buyers that only purchased with particular seller

Hi there

 

I am stuck with this dax measure and can't seem to wrap my head around it. 

I have a table with 3 columns (Althought the last one doesn't really matter)  

 

I would like to know the total number of buyers that only purchase with a certain seller

 

My Table

 

SellerBuyerSales
a1100
a2100
a3100
a4100
a4100
a6100
a6100
a6100
b1100
b3100
b1100
b3100
b2100
b2100
c1100
c2100
c3100
c4100
c1100
c5100

 

I think the middle step would be to group this table by the buyers and find the distinct seller count but I am not sure how to get to the next step 

 

group by buyer  
  
 Distinct SellerCount
13
23
33
42
51
61

 

Here we know that buyer 5 and 6 only purchased with 1 distinct seller (Can be multiple purchases)

 

Final Result wanted - (A measure that calculated the total number of buyers that only purchase with them)

 

SellerTotal number of buyers that only purchase with them
a1
b0
c1

 

The real table is around 20m rows with 500k distinct buyer and 2000 distinct seller.

 

Any help is appreciated

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @rigelng1995,

 

Please check following measures and see if the result achieve your expectation:

Measure = CALCULATE(DISTINCTCOUNT('Table'[Seller]),FILTER(ALL('Table'),'Table'[Buyer] = MAX('Table'[Buyer])))

Measure 2 = CALCULATE(DISTINCTCOUNT('Table'[Buyer]),FILTER(ALL('Table'),[Measure] = 1&&'Table'[Seller] = MAX('Table'[Seller])))

Result would be shown as below:

1.PNG

BTW, Pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @rigelng1995,

 

Please check following measures and see if the result achieve your expectation:

Measure = CALCULATE(DISTINCTCOUNT('Table'[Seller]),FILTER(ALL('Table'),'Table'[Buyer] = MAX('Table'[Buyer])))

Measure 2 = CALCULATE(DISTINCTCOUNT('Table'[Buyer]),FILTER(ALL('Table'),[Measure] = 1&&'Table'[Seller] = MAX('Table'[Seller])))

Result would be shown as below:

1.PNG

BTW, Pbix as attached, hopefully works for you.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

I ran it against my dataset - I think conditioning on distinctcount is too memory intensive for 20m rows. 

 

But tested against a subset and it works well. Thanks a lot for the help.

 

 

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.