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
lisago1978
Helper III
Helper III

Create % subtotal of categories filtered by 3rd variable

I am trying to create category subtotals on 1 table based on a filter of categories from a 2nd data table.

 

My first data table 'Inquiries V2'  has a list of caller names (CTName) and I am creating a total of the Entry IDs (unique row ID) based on the total CT name (filtered out 1 CTName category= HCP).

 

I created a new meaure in this table- 

_GT_I = COUNTX(FILTER('Inquiries V2','Inquiries V2'[Not_HCP]=1),[Entry ID])
 
Then, I tried to create a % subtotal to a 2nd data table'Inquiries Call Nature' that is long (meaning the Entry IDs are listed multiple times) The relationship between the 2 tables is a many to one baesed on the Entry ID (recall that the Entry ID is unique on the Inquiries V2 table)
 
I created another measure to do % Call Nature based on the values in the 2nd table and the denominator is the distinct count of Entry IDs from the 1st table
 
% C_Nature = CALCULATE(DIVIDE(SUM('Inquiries Call Nature'[Value]),'Inquiries V2'[_GT_I],ALLSELECTED('Inquiries Call Nature'[Value]))
 
I am getting error messages when I try to put this into a table
 
please advise, I am happy to send you my tables as excel docs or if there is a way to save somewhere in Power BI.

 

This is a sample of the Nature of Call Table 
     
date_createdEntry IDDate/Time of CallAttributeValue
6/30/2020 0:002311438084/28/2020 9:59Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311438084/28/2020 9:59Recommendations/SuggestionsRecommendations/Suggestions
7/22/2020 0:002399178237/22/2020 14:26Questions GuidanceAsking Questions/Seeking Guidance
7/22/2020 0:002399178237/22/2020 14:26Report Case/ConactReport Case/ Inquire Case or Contact Investigation
6/30/2020 0:002311438244/28/2020 8:34Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311442734/1/2020 14:26Reporting ViolationReporting Violation to Public Health Orders/Compliance with Order
6/30/2020 0:002311436184/27/2020 11:46Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311441734/23/2020 14:52Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311441734/23/2020 14:52Recommendations/SuggestionsRecommendations/Suggestions
6/30/2020 0:002311439004/26/2020 10:49Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311439004/26/2020 10:49Recommendations/SuggestionsRecommendations/Suggestions
6/30/2020 0:002311436614/29/2020 14:42Questions GuidanceAsking Questions/Seeking Guidance
7/22/2020 0:002399036207/22/2020 13:53Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311438674/27/2020 13:51Questions GuidanceAsking Questions/Seeking Guidance
7/22/2020 0:002398968017/22/2020 13:40Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311436444/29/2020 15:32Questions GuidanceAsking Questions/Seeking Guidance
6/30/2020 0:002311436444/29/2020 15:32General ComplaintGeneral Complaint
 
 This is a sample of rows for the Inquiries V2 table
 
date_createdEntry IDDate/Time of CallCT Name  
6/30/20202.31E+084/28/2020General Public  
7/22/20202.4E+087/22/2020Business  
6/30/20202.31E+084/27/2020Missing  
6/30/20202.31E+084/28/2020General Public  
6/30/20202.31E+084/1/2020Business  
6/30/20202.31E+084/27/2020Missing  
6/30/20202.31E+084/27/2020General Public  
7/22/20202.4E+087/22/2020Health Care Provider  
6/30/20202.31E+084/23/2020Health Care Provider  
6/30/20202.31E+084/23/2020General Public  
6/30/20202.31E+084/26/2020General Public  
6/30/20202.31E+084/29/2020Business  
7/22/20202.4E+087/22/2020Special Setting  
6/30/20202.31E+084/27/2020Business  
7/22/20202.4E+087/22/2020Special Setting  
6/30/20202.31E+084/27/2020Health Care Provider  
7/22/20202.4E+087/22/2020Health Care Provider  
6 REPLIES 6
v-xicai
Community Support
Community Support

Hi   @lisago1978 ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

amitchandak
Super User
Super User

@lisago1978 , refer 1 of the 3

% C_Nature =DIVIDE(SUM('Inquiries Call Nature'[Value]),calculate(SUM('Inquiries Call Nature'[Value]),all('Inquiries Call Nature')))

% C_Nature =DIVIDE(SUM('Inquiries Call Nature'[Value]),calculate(SUM('Inquiries Call Nature'[Value]),all('Inquiries Call Nature'[_GT_I])))

% C_Nature =DIVIDE(SUM('Inquiries Call Nature'[Value]),calculate(SUM('Inquiries Call Nature'[Value]),allexcept('Inquiries Call Nature'[_GT_I])))

 

Also refer :

https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Sorry none of those are working, I changed Entry ID to a whole number, but when I do this formula, which is still not right because it is not filtered on a third value I get 0 or 1 instead of the %

 

_% Call_N = DIVIDE(SUM('Inquiries Call Nature'[Entry ID]),CALCULATE(SUM('Inquiries Call Nature'[Entry ID]), ALLSELECTED('Inquiries Call Nature'[Value])))
 
The Value is a set of text categories so at the very least I need subtotals by these categories. I also need the denominator to be a total count minus one category from a different table (variable).

Hi @lisago1978 

 

could you provide a .pbix-file with your data, the measures you have made so far and visuals you need? Upload them to dropbox/onedrive/other and share the link.

 

Cheers,
Sturla

Hi @lisago1978 ,

 

You may change the Cross filter direction of relationships between the two tables from Single to Both , which will take the two tables treated as a single table, then create measure like DAX below.

 

_% Call_N = DIVIDE(SUM('Inquiries Call Nature'[Entry ID]),CALCULATE(SUM('Inquiries Call Nature'[Entry ID]), ALLSELECTED('Inquiries Call Nature' )))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Unfortunately, none of these worked. Could it be the call nature table I created was a subset of the first where I took a wide column and made it long.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.