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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Issues with subtotals

Challenge 1 - Sum the Team Sales and return those sale for each person on the team while keeping each non-team member (i.e. Employees 4+5) separate as their own non related line item.
Challenge 2 - In the Team A Subtotal, return the total for the team vs. summing each employee line item.
Challenge 3 - The manager should be the total of Team A plus the 2 Employees who do not belong to Team A.
Result issues in red.        
         
I've tried the following solution from this post but its not working for this circumstance.  I've also tried modifying this solution but have been unsuccessful in getting it to work.    
https://community.powerbi.com/t5/Desktop/Sum-of-values-based-on-distinct-values-in-other-column/m-p/...    
         
Measure = MAXX(DISTINCT(Hierarchy[Team]),MAX(Sales[Sales]))       
SumSales = SUMX(DISTINCT(Hierarchy[Team]),[Measure])       
Sales MTD = CALCULATE([SumSales]),DATESMTD(Sales[Result Period]))      
Sales YTD = CALCULATE([SumSales]),DATESYTD(Sales[Result Period]))       
         
Hierarchy and Sales tables are related to one another using a HierarchyKey with a one to many relationship.    
         
         
Correct Result  MonthlyYTD through March
ManagerEmployee TeamEmployee NameSalesTarget%SalesTarget%
Manager 1Team AEmployee 19000060000150%270000180000150%
Manager 1Team AEmployee 29000060000150%270000180000150%
Manager 1Team AEmployee 39000060000150%270000180000150%
  Team A Subtotal9000060000150%270000180000150%
Manager 1 Employee 4100003000033%300009000033%
Manager 1 Employee 5100003000033%300009000033%
Manager 1  11000012000092%33000036000092%
         
         
Result I'm Getting  MonthlyYTD through March
ManagerEmployee TeamEmployee NameSalesTarget%SalesTarget%
Manager 1Team AEmployee 16000060000100%180000180000100%
Manager 1Team AEmployee 2300006000050%9000018000050%
Manager 1Team AEmployee 30600000%01800000%
   9000018000050%27000054000050%
Manager 1 Employee 4100003000033%3000030000100%
Manager 1 Employee 5100003000033%3000030000100%
Manager 1  11000024000046%33000060000055%
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

I'd like to suggest you take a look at the following links about using the if statement to check the current row context level and handle multiple aggregations of measure total level calculations:

Clever Hierarchy Handling in DAX - SQLBI

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

I'd like to suggest you take a look at the following links about using the if statement to check the current row context level and handle multiple aggregations of measure total level calculations:

Clever Hierarchy Handling in DAX - SQLBI

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.