cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ilias69
Regular Visitor

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
Solution Sage
Solution Sage

Try replacing your ALL(Database[Name1]) with

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

View solution in original post

4 REPLIES 4
johnt75
Solution Sage
Solution Sage

Try replacing your ALL(Database[Name1]) with

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

It works, thank you @johnt75 !

 

Ilias

johnt75
Solution Sage
Solution Sage

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.

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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors