cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anshenterprices
Helper III
Helper III

dax to calculate top 3 customer name by sales filtered by category and date

Source Table

DateCategorycustomore nameSales
4/6/2021Equitya123
4/6/2021Equityb345
4/6/2021Equityc567
4/6/2021Equityd789
4/6/2021Equitye1011
4/6/2021Equityf1233
4/6/2021Equityg1455
4/6/2021Equityh1677
4/6/2021Equityi1899
4/6/2021Equityj2121
4/6/2021Equityk2343
4/6/2021Equityl2565
4/6/2021Commodityd453
4/6/2021Commoditye564
4/6/2021Commodityf234
4/6/2021Commodityg453
4/6/2021Commodityh564
4/6/2021Commodityi234
4/6/2021Commoditya399
4/6/2021Commodityb564
4/6/2021Commodityc729
5/6/2021Equityg894
5/6/2021Equityh1059
5/6/2021Equityi1224
5/6/2021Equityj342
5/6/2021Equityl1554
5/6/2021Equityd1719
5/6/2021Equitye1884
5/6/2021Equityf2049
5/6/2021Equityg2214
5/6/2021Equityh234
5/6/2021Equityi2544
5/6/2021Equityk2565



I need a top 3 customer name by sales and filtered by category and date divided by total sales  filtered by category and date

eg. date 4/6/2021 top 3  customer sales =7029 for category equity divided by totalsales of equity category and date4/6/2021  is 16128
o/p= 7029/16128
= 44%

2 ACCEPTED SOLUTIONS
v-deddai1-msft
Community Support
Community Support

Hi @Anshenterprices ,

 

Please use the following measure:

Measure = DIVIDE(SUMX(TOPN(3,'Table',CALCULATE(SUM('Table'[Sales]))),'Table'[Sales]),SUM('Table'[Sales]))

 

Capture19.PNG

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

Ashish_Mathur
Super User III
Super User III

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User III
Super User III

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-deddai1-msft
Community Support
Community Support

Hi @Anshenterprices ,

 

Please use the following measure:

Measure = DIVIDE(SUMX(TOPN(3,'Table',CALCULATE(SUM('Table'[Sales]))),'Table'[Sales]),SUM('Table'[Sales]))

 

Capture19.PNG

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

MintuBaruah
Helper II
Helper II

Hi @Anshenterprices 

 

For your measure, You can use TOPN Dax formula to calculate the top 3 customer names by sales.

 

Regards,

Mintu Baruah

If you find the solution useful please mark my post as a solution!
In doing so, you are also helping me. Thank you!

amitchandak
Super User IV
Super User IV

@Anshenterprices , Try a measures like

 

Sales M = sum(Table[Sales])

CALCULATE([Sales M],TOPN(10,allselected(Table[Customer]),[Sales M],DESC),VALUES(Table[Customer]))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors