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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
thisisyingchi
Helper I
Helper I

The total is still grand total after filter, how to fix this problem?

Dear all,

In this Matrix, the BU will change because of the "Item" filter, and the sumx(amount) and all(BU) works perfectly as I want; however, the total of all(Item) and allexcept(BU) always show the total without any filter, basically the grand total. What I expect, instead, is the total of the yellow box.

Please help to point out which DAX function I might can use to solve this problem?
I tried few different combinations of Calculate( sumx(amount), all()/ allexcept()/ allselected()), but non of them can show the total of the yellow box. Thank you.

未命名.png

 

 

1 ACCEPTED SOLUTION

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

13 REPLIES 13
v-kkf-msft
Community Support
Community Support

Hi @thisisyingchi ,

 

Please try the following formula:

 

Measure = SUMX ( VALUES ( 'Table'[BU] ), [allexcept(BU)] )
Measure 2 = SUMX ( ALLSELECTED ( 'Table'[BU] ), [Measure] )

vkkfmsft_0-1646631748061.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello @v-kkf-msft ,

Thank you for your time, but I can't open your file due to the version I used being older.
I tried the formula you shared, but maybe I misunderstood, anyway it didn't really work.
I send you a sample dataset by pm and explain more details I expected there. 
Please help to check your message box and let me know if more information is needed, thank you.

vojtechsima
Memorable Member
Memorable Member

Hi, @thisisyingchi ,
please share a sample dataset (copyable) so I can test my suggestions. THanks

 

Hello @vojtechsima ,
The sample dataset is sent to you by pm, please check your message box and let me know if any problem. Thank you for your time and help! 🙂

Hello, @thisisyingchi , 
Thank you for your dataset, this worked for me:

vojtechsima_0-1646651781796.png

 

var __SelectedBUs = VALUES('sample'[BU])

var __calc = CALCULATE(SUM('sample'[Something]),ALLEXCEPT('sample','sample'[BU]), 'sample'[BU] IN __SelectedBUs)

return __calc

 


Please note "Something" is just renamed column of "金額".

Hi,
It works well, but the problem of the column all(Item) doesn't be solved.
Could you share more? 未命名.png

 

The ideal result for me is as below if "Item AD" is selected:

BUAmount(金額)Total by BUTotal by ItemTotal by selected BU
Elle5500706892765008608966
Louis1000154003965008608966
Total6500860896665008608966

 

Because at the end I want to know the proportion as follows:

  • Amount/Total by BU
  • 1 - Amount/Total by BU
  • Total by Item/Total by selected BU 

Sorry if I didn't express the need clearly at first.

Hi,

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 @Ashish_Mathur,

Due to the sensitive information, I can't share the PBI directly with you, but I sent you the sample dataset by pm. Please check your message and let me know if any problem, thank you.

 

ps. The column titled "金額" means amount.

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/

Hi @Ashish_Mathur ,

 

Thank you for the help!! This is exactly what I want!!

In case there are some people who can't open your file with the previous PBI version, I hope you don't mind I copied your formula to here.

thisisyingchi_0-1646803335939.png

Amount = SUM(Data[金額])
Total by Item = CALCULATE([Amount],ALL(Data[bu]))
Total by BU (Inter) = CALCULATE([Amount],ALLEXCEPT(Data,Data[BU]))
Total by BU = SUMX(VALUES(Data[BU]),[Total by BU (Inter)])
Measure = CALCULATE([Total by BU],ALL(Data[bu]))

 

 

You are welcome.


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

Hi, @Ashish_Mathur 
even tho I am not the author, I thank you for your answer, I was struggling to figure out the last column because I thought it wouldn't be this simple, but it is. 
So, amazing work, thank you.

You are welcome.  Thank you for your kind words.


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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors