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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
HarishRathore
Helper II
Helper II

Top 1 Customer by product with sales of each brand in that top outlet

Hi,

I have a data model in power pivot where I wanted top  customer per product using this measure : 

 

Top Customer Name = Maxx(TopN (1, Summarize ( Customers, Customers[Customers Name], "Vol", [Total Volume]), [Vol], DESC ), Customers[Customers Name])

 

I am getting desired result but only thing is when i am putting brand in row field and the said measure in value field then i am getting result but the moment put "Total Volume" in value field then i am getting the complete volume of that particular brand against that top outlet but I want that what is volume of that brand against that top outlet. Can you please help me in this regards????

Regards

 

1 ACCEPTED SOLUTION

Hi,

I think these measures work

Top Customer = FIRSTNONBLANK(TOPN(1,VALUES(Customer[CustomerKey]),[Sales Amount]),1)
Top Customer sales = SUMX (TOPN(1,VALUES(Customer[CustomerKey]),[Sales Amount]),[Sales Amount])

Hope this helps.

Untitled.png

 


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

View solution in original post

23 REPLIES 23
Anonymous
Not applicable

You should have relationships between your products, customers and the fact table. If you do, then SUMMARIZE does work with different tables.

By the way, you should not use SUMMARIZE to calculate anything within it. This is a VERY DANGEROUS function that should only be used to give you the existing combinations of values from a (expanded) table. There is an article about it on www.sqlbi.com, which is the ultimate source of wisdom about DAX. Instead of SUMMARIZE you sohuld use a combination of SUMMARIZE/ADDCOLUMNS. If you choose to ignore what I've just written, be prepared to produce numbers which you will not be able to explain. Easy as that.

You've been warned.

Best
D

Then please help me how to achieve the desired result. I want to know the top (number 1 ) customer by brand and how much is the volume. Please help with DAX measure.
Anonymous
Not applicable

It's very easy to have a measure that will return the Top 1 customer w.r.t. any measure and the associated values from any measures. If you have such a measure, then to get the Top 1 customer by Brand you just filter by the brand (for instance, placing brands in a column of a visual) and the measure takes care of the rest.

I'll look into this once I get a chance.

Best
D

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors