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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SamTaylor
Helper I
Helper I

Sub totals with Multiple Columns

Hi,

Please can you help.  Below is a picture of the subtotal FP Sales % I am trying to achieve.

 

It works when I only have Rep_Grp and Rep_SC in the pivot table. But when I add Prod_Rep, Rep_Desc and RRP it does not work.

 

I am using:

FP Sales % = [Total FP Sales] / CALCULATE ( [Total FP Sales] , All ( Products [Rep_Grp]))

 

Thanks

Sam

 

Subtotal_Q.jpg

 

 
 

 

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @SamTaylor ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

v-stephen-msft
Community Support
Community Support

Hi @SamTaylor ,

 

For the issue of subtotal not working properly, HASONEVALUE function might be the solution

There is a similar post, please kindly refer to:

Subtotal not working properly

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@SamTaylor , Not very clear. You can Try

FP Sales % = [Total FP Sales] / CALCULATE ( [Total FP Sales] , All ( Products ))

 

You can also use allexcept as per need

Change the column as per need. This means to remove all filter except Rep_Grp

FP Sales % = [Total FP Sales] / CALCULATE ( [Total FP Sales] , allexcept (Products ,  Products [Rep_Grp]))

 

https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept...

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

 

AllisonKennedy
Super User
Super User

Hi @SamTaylor 

 

What result are you looking for? What do you mean when you say it works with only Rep_Grp and Rep_SC in the pivot table but then breaks? Are  Prod_Rep, Rep_Desc and RRP all in the same table as Rep_Grp and Rep_SC? Please provide data model picture too (diagram view). 

 

It also looks like you have some filters which may be further complicating things? 

 

The measure you have written will only clear filters on the Rep_Grp column, so it keeps filters from other columns such as Prod_Rep and Rep_Desc. If you want the percent of Grand Total, in Power BI you could just use ALL() but I don't think you have that option in Excel. So you need to determine what filters you want to remove. I can't remember if you can use ALL(Product) in Excel - that might get you close. 

https://docs.microsoft.com/en-us/dax/all-function-dax 

If this doesn't help, please describe what values you want as grand total and what filters you have applied, as well as your data model relationships. 

 

Cheers!


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.