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

TOP 5 Sales as benchmark for other metrics

Hi I would like to prepare banchmark which is basing on top5 sales cities

 
My DAX formula for Top 5 ProductSales Cities looks like below:
 
TOP 5 =
VAR
Gettop5reg= VALUES( 'Table1'[City] )
RETURN
CALCULATE( [totalSales],
TOPN( 5,
ALL( 'Table1'[City] ),
[totalSales] ),
Gettop5reg
)

 

now I would like to calculate average of ServiceSales only for this TOP5 ProductsSales cities and use as a benchmark for ServiceSales for specific region.

 

 

Country CityProductSalesServiceSales
UKLondon155505465
UKManchester255683541
UKLiverpool100052516
UKBristol89551518
UKCoventry471152134
UKLeeds565551563
ESBarcelona1112551146
ESMadrit956749998
ESToledo111556652
ESBilbao3596313215
ESSevilla545895444

 

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this measure help

Average TOP 5 service sales=
VAR
Gettop5reg= VALUES( 'Table1'[City] )
RETURN
CALCULATE(average( 'Table1'[ServiceSales]),
TOPN( 5,
ALL( 'Table1'[City] ),
[totalSales] ),
Gettop5reg
)

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

View solution in original post

8 REPLIES 8
dzaba
Frequent Visitor

this works fine, thank you very much, but I have other question to that: If I would like to put this measure to the table, to have average of this 5 regions in all rows? 

 

like in every row in second column I would like to see 44,53

 

 

dzaba_0-1619689188501.png

 

You are welcome.  I can try but not sure of whether i will be able to solve it or not.  Share the link from where i can download your PBI file.


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

Hi, here is the file, thanks in advance! 🙂

https://1drv.ms/u/s!AmHaMHGdkcnBatiQFJMfYt2P0qQ?e=uoaWRX 

Hi,

This measure works

Measure = COALESCE([Average TOP 5 service sales],CALCULATE([Average TOP 5 service sales],ALL('Table')))

Hope this helps.

Untitled.png


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

Thanks, almost what I need 🙂 

I remove COALESCE

 

and now i have the benchmark for gauge chart, but how to divide it per country? now I have the average for all, I need separate for UK and ES

 

 

dzaba_0-1620132204727.png

 

dzaba
Frequent Visitor

Ok, I update the function to:

Measure = CALCULATE([Average TOP 3 service sales],ALL('Table'[City]))
 
In tabel looks ok, but when I'm using it on charts always took the average of total
dzaba_1-1620135575160.png

 

 
dzaba_2-1620135614355.png

 

 

Those images are way too small.  There is nothing i can understand.


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

Hi,

Does this measure help

Average TOP 5 service sales=
VAR
Gettop5reg= VALUES( 'Table1'[City] )
RETURN
CALCULATE(average( 'Table1'[ServiceSales]),
TOPN( 5,
ALL( 'Table1'[City] ),
[totalSales] ),
Gettop5reg
)

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

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.