Is there an Easier Sub Total DAX Formula than this?

JimMatthews

New Member
Joined
Aug 12, 2014
Messages
9
Hi, I have a question with a sub total percentages problem.

I have done what I want and it is working as I want.

As you can see from this image,
https://www.dropbox.com/s/9m3su0l2lcstvcr/subtotals.png
subtotals.png


the 1, 2 and 3 KG sub totals add up to 100%. Also, when I drill into one of the pack sizes, the percentages add to 100% for that pack size - this is exactly what I want.


My question is, is there any 'easier' and 'better' DAX to get this result other than what I have created here.

Code:
[FONT=Calibri]=if(HASONEVALUE(Products[ProdDesc])[/FONT]
[FONT=Calibri]     ,DIVIDE([Total Sales][/FONT]
[FONT=Calibri]                  ,CALCULATE([Total Sales][/FONT]
[FONT=Calibri]                                       ,all(Products)[/FONT]
[FONT=Calibri]                                       ,VALUES(Products[Pack Size])[/FONT]
[FONT=Calibri]                                        )[/FONT]
[FONT=Calibri]                   )[/FONT]
[FONT=Calibri]     ,DIVIDE([Total Sales][/FONT]
[FONT=Calibri]                  ,CALCULATE([Total Sales][/FONT]
[FONT=Calibri]                                       ,all(Products)[/FONT]
[FONT=Calibri]                                       )[/FONT]
[FONT=Calibri]                  )[/FONT]
[FONT=Calibri]     )[/FONT]

Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Nope. There is no "generic" or one size fits all "Percent of Parent" in dax. If you don't need to USE those % in other calcs, you could just change the display settings on the pivot table column in excel, but for "real dax"... that is it.
 
Upvote 0

Forum statistics

Threads
1,224,041
Messages
6,176,026
Members
452,697
Latest member
CuriousSpreadsheet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top