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
Anonymous
Not applicable

Line and clustered column chart, TOP N filter and % on total and not only on filter values

Hi everyone, 

 

I want to make a top 10 list of our customers in terms of weight shipped by air.

However, I am having a problem with the % of weight each customer represents on the total.

Instead of displaying this %, it displays me the % that each customer represents on the TOP 10.

I think my Top N filter is impacting my formula but I don't know how to correct it.

 

Here is my formula :

% graph bar = sum(Database[Total Weight])/CALCULATE(SUM(Database[Total Weight]), ALL(Database[Name 1]))

 

Ilias69_0-1648808460590.png

 

Ilias69_1-1648808483302.png

 

Thanks a lot.

 

Regards,

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try replacing your ALL(Database[Name1]) with

ALLEXCEPT( 'Database', 'Database'[CurrShipmentStart], 'Database'[Shipping type])

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Try replacing your ALL(Database[Name1]) with

ALLEXCEPT( 'Database', 'Database'[CurrShipmentStart], 'Database'[Shipping type])
Anonymous
Not applicable

It works, thank you @johnt75 !

 

Ilias

johnt75
Super User
Super User

Use Performance Analyzer to get the DAX code generated by your chart. It may be that filters are being applied to other columns on Database in addition to Name1. If so you will need to remove the filters on those columns as well.

It may be enough simply to change ALL(Database[Name1]) to ALL(Database) but I don't know if any other filters are being applied which you need to be honoured, like date for example.

Anonymous
Not applicable

Hi @johnt75 ,

 

Thanks for your reply.

 

Indeed, filters have an impact on this visual. There is a date filter and a shipping type filter.

 

Here is part of the result after using the Performance Analyzer:

// DAX Query
DEFINE
VAR __DS0FilterTable =
TREATAS({"40"}, 'Database'[Shipping type])

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('Database'[CurrShipmentStart])),
AND(
'Database'[CurrShipmentStart] >= DATE(2022, 1, 1),
'Database'[CurrShipmentStart] < DATE(2022, 4, 1)
)
)

 

This visual must allow me to see the total weight shipped only for the top 10 customers with a shipping type "40", hence the importance of filters.

 

But I would like the % that each customer represents to be calculated on the total weight shipped for all our customers and not the total weight shipped by the top 10.

 

Is it possible to do this? 

 

Thank you.

 

Regards,

 

Ilias

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.