cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Top N Each Customer and Sales Amount

Hi there,

 

I have following data:

 

Date, Customer Name and Sales Amount

 

I am looking for date on which the highest sales happend for each customer, highest sales means sum of sales for each date.

 

Customer   Highest Date for the Sale   Total Amount of sales on highest sales date

 

I hope it is pretty straight forward. Thanks in advance.

 

P






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





2 ACCEPTED SOLUTIONS

Accepted Solutions
v-huizhn-msft Super Contributor
Super Contributor

Re: Top N Each Customer and Sales Amount

Hi @parry2k,

I create the following sample table.

1.PNGSample table
First, create two calculated column using the formulas.

Each customer'sales in each date = CALCULATE(SUM(Table4[Sales amount]),ALLEXCEPT(Table4,Table4[Customer Name],Table4[Date]))

MAx sales for each customer = CALCULATE(MAX(Table4[Each customer'sales in each date]),ALLEXCEPT(Table4,Table4[Customer Name]))

2.PNG

Second, create two measures using the formulas below.

Highest Date for the Sale = CALCULATE(FIRSTDATE(Table4[Date]),FILTER(Table4,Table4[Each customer'sales in each date]=Table4[MAx sales for each customer]))

Total Amount of sales on highest sales date = MAX(Table4[Each customer'sales in each date])


Finally, create a table visual, select the customer name and the two measures as values, you will get expected result.

5.PNG

Best Regards,
Angelia

Super User
Super User

Re: Top N Each Customer and Sales Amount

Hi @parry2k,

 

You may refer to my solution here.

 

Hope this helps.

4 REPLIES 4
Super User
Super User

Re: Top N Each Customer and Sales Amount

Hi,

 

Is this the result you are expecting?

 

Untitled.png

Super User
Super User

Re: Top N Each Customer and Sales Amount

Yes @Ashish_Mathur. Will be helpful if you share the formulas. Thanks






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





v-huizhn-msft Super Contributor
Super Contributor

Re: Top N Each Customer and Sales Amount

Hi @parry2k,

I create the following sample table.

1.PNGSample table
First, create two calculated column using the formulas.

Each customer'sales in each date = CALCULATE(SUM(Table4[Sales amount]),ALLEXCEPT(Table4,Table4[Customer Name],Table4[Date]))

MAx sales for each customer = CALCULATE(MAX(Table4[Each customer'sales in each date]),ALLEXCEPT(Table4,Table4[Customer Name]))

2.PNG

Second, create two measures using the formulas below.

Highest Date for the Sale = CALCULATE(FIRSTDATE(Table4[Date]),FILTER(Table4,Table4[Each customer'sales in each date]=Table4[MAx sales for each customer]))

Total Amount of sales on highest sales date = MAX(Table4[Each customer'sales in each date])


Finally, create a table visual, select the customer name and the two measures as values, you will get expected result.

5.PNG

Best Regards,
Angelia

Super User
Super User

Re: Top N Each Customer and Sales Amount

Hi @parry2k,

 

You may refer to my solution here.

 

Hope this helps.

Helpful resources

Announcements
Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 292 members 2,741 guests
Please welcome our newest community members: