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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to create a subtotal for Column on a table? My measure is not working.

Hello,
 
I am trying to get the subtotal for Net_Claim_Amt by PrimaryName and Year, but when I add my calculated measure, I don't think it works for PrimaryName. For the Year it does not work at all, somehow and some of the column numbers will disappear.

Can anybody please tell me how to fix this? 
 
My formulas -
 

 

Sub_Total_For_Year = CALCULATE([Net_Claim_Amt], ALLEXCEPT('XL-Hargrove_MpciPolicy_Data','XL-Hargrove_MpciPolicy_Data'[Year]))
Sub_Total_For_PrimaryName = CALCULATE([Net_Claim_Amt], ALLEXCEPT(Grower,Grower[ PrimaryName]))

Claim_amt = [Max_$_Guar] - [Harvest_Value]
Max_$_Guar = SUM('XL-Hargrove_MpciPremLine_Data'[Guar in lb or bu]) * [MAX_Price]
Harvest_Value = SUM(PriceKeys[ HarvestPrice]) * SUM('XL-Hargrove_ProductionReported_Data'[ TotalProductionAmount])

* MAX_Price also calculated Measure

 

Data with Subtotals, 
 
On this one, you can see it is not summing Net_Claim_Amount for the Primary name. I Just want to get  Total Net_Claim_Amount for the Primary name. 
Primary Name.PNG

 

Over here, When I add some of the column values are missing and it is not working. Same thing here, I just need the total Claim Amount by Year. 

Year.PNG

 

Hopefully, all the above things make sense. Any help will really appreciate it. 
 
Thank you so much
5 REPLIES 5
AllisonKennedy
Super User
Super User

@Anonymous  You have a lot of bidirectional relationships. Without knowing your data, I can't be certain, but these are typically not needed and can cause problems. See this post and video here, it's the best explanation I've seen so far: https://www.sqlbi.com/articles/bidirectional-relationships-and-ambiguity-in-dax/

 

I'll see if I can figure out your other problem, but you most likely need to fix your data model first.


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

AllisonKennedy
Super User
Super User

@Anonymous Can you please share screenshot of relationships for all these tables? And actually, on looking at this again you might have been right with ALLEXCEPT, sorry, it's the weekend and my brain is not firing on all cylinders! 😛


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

Anonymous
Not applicable

@AllisonKennedy  Thank you so much for the help. 

Please check on the link. I think you will get more ideas other than a screenshot. I have everything on my measure table. I also filter out for two Primary names  (Otherwise it will get messy). Please Ignore the Primary name, since this will be sample data (The primary name does not make any sense when I trim it down) 

 

https://drive.google.com/file/d/1heoTuzrvhC5yFHPGsxoGTe0ECzHS7gfQ/view?usp=sharing 

 

I really appreciate it if you could help me out with this. 

 

Again, Thank you 

AllisonKennedy
Super User
Super User

Try using ALL(Year) and ALL(PrimaryName) instead of ALLEXCEPT. ALLEXCEPT keeps the filter on the specified columns. It sound like you want to ignore the filter on PrimaryName and Year. Also, you should try adding Year from your DimDate table instead and see if that brings back the missing values. Use that in the ALL() function as well. 


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

Anonymous
Not applicable

Hi @AllisonKennedy 

 

Thank you so much, I tried after you telling me to do so, still no luck. It did not work for me.  I tired both Year And Primary name.  Please tell me if I done something wrong or any other idea. 
 

Sub_Total_For_PrimaryName = CALCULATE([Net_Claim_Amt], ALL(Grower[ PrimaryName]))
Sub_Total_For_Year = CALCULATE([Net_Claim_Amt], ALL('XL-Hargrove_MpciPolicy_Data'[Year]))


er1.PNG

 Again, thank you so much for your time and help. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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