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
aymeric
New Member

number of sales per buyer / number of distinct buyer

Hi community,

 

I have a classic sales Table, each row representing a sale, with the name of the buyer ("Buyer" column), and the date of the sale ("Date", column). Here's a sample below.

 

 

BuyerDate
Jeanjan-17
Jeanfeb-17
Jeanmar-17
Jeanapr-17
Jeanmay-17
Pierrejan-17
Pierrefeb-17
Pierremar-17
Pierremay-17
Pauljan-17
Paulmay-17

 

I'd like to create a table that provides the number of buyers who have the same number of sales, during a period I could set with a date slicer. 

 

Based on my previous example :

  • for the period starting from january and ending in may, this would lead to 
number of sales per buyernumber of distinct buyers
21
41
51

 

  • for the period starting from april and ending in may, this would lead to 
number of sales per buyernumber of distinct buyers
12
21

 

Any ideas ?

 

Many thanks in advance for your help !!

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@aymeric,

In your scenario, you would need to create the following measures and drag Buyer field to visual in order to get right result.

Number of sales per buyer = CALCULATE(COUNTROWS(Table),FILTER(Table,Table[Date]<=max(Table[Date])))
Number of buyers = DISTINCTCOUNT(Table[Buyer])


1.PNG2.PNG



Regards,
Lydia

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

Hi Lydia,

 

Thank you very much for your help.

 

Actually what I'm trying to get is a bit different from your suggestion.

 

Indeed my list of buyers contains more than 1 million names and I don't want them to appear in my visual. 

 

What I want to know (to be read directly in the visual) is how many distinct buyers bought the same number of products, for the period set via a date slicer.

 

If I withdraw the buyer field (as described in your solution), I can't get access anymore to the distribution of sales.

 

Thanks again in advance for your help on this.

 

Warm regards

@aymeric,

I am afraid that your requirement can't be achieved. Because the "number of sales per buyer " measure and "number of distinct buyer" measure are evaluated based on the Buyer field, and they are dynamically filtered by Date slicer. Without Buyer , the two measures will be aggregated.

Regards,

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

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.