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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
m_wex
Helper I
Helper I

Stuck on %of Total Problem

I am working with grouping previous year customer sales into small, medium, and large buckets. A Customer size table has been created for the grouping:

m_wex_0-1715981980332.png

With a page filter for small, medium, and large sales can be displayed for the selected size.

The dax formula to calculate sales is:

 

CY Customer Sales by Grouping  4 Test =
Calculate([CY Total Sales],
filter(values(Sales[Sold-To Party]),  
    countrows(
        Filter('Customer Size Table',
        [PY Total Sales]>='Customer Size Table'[Min]&&
        [PY Total Sales]<= 'Customer Size Table'[Max]))>0))
 
The problem that I am having is that I am trying to write a DAX for % of Total sales which compares the size selected to ALL sizes.
The formula that I have is below but is not working. I understand that the size filter has to be removed from one portion of the DAX but the solution is escaping me.
 
This does not work: % of Total Customer Size Test 4 = divide([CY Customer Sales by Grouping  4 Test],calculate([CY Customer Sales by Grouping  4 Test]),all('Customer Size Table'[Size]))
 
Any help would be greatly appreciated.
 
 
1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @m_wex 

You can perform a flexible % analysis using Dax, and there are many ways to produce your required output and one of them is as follows.  (I've created a dummy sales data in order to demonstrate in this example). 

Assuming that your Sold-To-Party information is not repetitive (i.e., unique), you can create a calculated column to pre-calculate classification into sales size groupings for each sold-to-party.

DataNinja777_0-1716012175170.png

 

Then create a relationship between your size dimension table and your fact table with the sales figures and sales size grouping for each sold-to-party.

DataNinja777_1-1716012267680.png

Then, create an intermediary measure like below which ignores filter of the size dimention by using all(Size) table, and divide the sales measure with this one to get the % of each size grouping over the total sales amounts. 

DataNinja777_2-1716012343094.png

You can do the similar calculation in many different ways, but the above one is breaking down the steps for simplicity purposes. 

I attach an example pbix file, too.  

Best regards,

 

 

View solution in original post

1 REPLY 1
DataNinja777
Super User
Super User

Hi @m_wex 

You can perform a flexible % analysis using Dax, and there are many ways to produce your required output and one of them is as follows.  (I've created a dummy sales data in order to demonstrate in this example). 

Assuming that your Sold-To-Party information is not repetitive (i.e., unique), you can create a calculated column to pre-calculate classification into sales size groupings for each sold-to-party.

DataNinja777_0-1716012175170.png

 

Then create a relationship between your size dimension table and your fact table with the sales figures and sales size grouping for each sold-to-party.

DataNinja777_1-1716012267680.png

Then, create an intermediary measure like below which ignores filter of the size dimention by using all(Size) table, and divide the sales measure with this one to get the % of each size grouping over the total sales amounts. 

DataNinja777_2-1716012343094.png

You can do the similar calculation in many different ways, but the above one is breaking down the steps for simplicity purposes. 

I attach an example pbix file, too.  

Best regards,

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.