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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Percentage of subtotal

I'm trying to get the Matrix table to calculate percentages based on a subtotal.   In this case, I'd like the highlight below to calculate 4 divided by 19 for a total of 21.05%.   Instead, it is looking at the Grant Total and returning a much lower answer (13%).   I've tried multple things but have been unsuccessful.    Please help.

Capture.PNG

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Great to hear it works!

 

You can change the formatting of the measure to Percentage under Modeling tab like below. Smiley Happy

 

f1.PNG 

 

Regards

View solution in original post

17 REPLIES 17
mattbrice
Solution Sage
Solution Sage

Can you try:

 

%CT Unique =
VAR this_Unique =
    SUM ( Table[Unique] )
VAR group_unique =
    CALCULATE (
        SUM ( Table[Unique] ),
        ALL ( Table[Option Code], Table[Option Description] )
    )
RETURN
    DIVIDE ( this_unique, group_unique )
Anonymous
Not applicable

Per my last post minutes ago, I tried recreating the measure as a "new column".   I am still getting the same results.   The line I have highlighted should be around 21%.

 Capture.PNG

 

Hi @Anonymous,

 

Based on my with your shared pbix file, the formula works fine in your scenario if you use it to create a measure instead of a calculate column. 

Measure %CT Unique = 
VAR this_Unique =
    SUM ( 'options selected'[Unique] )
VAR group_unique =
    CALCULATE (
        SUM ( 'options selected'[Unique] ),
        ALL ( 'options selected'[Option Code], 'options selected'[Option Description] )
    )
RETURN
    DIVIDE ( this_unique, group_unique )

r3.PNG

 

Here is the modified pbix file for your reference. Smiley Happy

 

Regards

Anonymous
Not applicable

This looks awesome!   Works great.   I am interested in how you got the % to appear as a 2-digit decimal (21.05%).   I can't find where I have the same formatting options with a new measure; as a result, my # appears as .21.

 

Thanks again for your help!

Hi @Anonymous,

 

Great to hear it works!

 

You can change the formatting of the measure to Percentage under Modeling tab like below. Smiley Happy

 

f1.PNG 

 

Regards

Anonymous
Not applicable

This worked out great - Thanks for your help!

Hi @Anonymous,

 

Could you share a sample pbix file which can reproduce the issue, so that we can further assist on this issue? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading. Smiley Happy

 

Regards

Anonymous
Not applicable

Hi @Anonymous,

 

The file is not accessible for me, as I don't have the BOX account. Could you upload it to OneDrive or Dropbox instead and post the link here? Smiley Happy

 

Regards

Anonymous
Not applicable

Anonymous
Not applicable

Quick question -- can the "unique" field which I created as a new measure be included in the formula?   It doesn't appear to be recognized as a Table field like the other fields when I try to use this example .

Anonymous
Not applicable

 

What are are the proper steps for me to share this file with this group?   Do I need to publish and provide the URL?  Please advise.

Anonymous
Not applicable

My organization has turned off the feature to share files with anyone outside the organization.    Are there any other suggestions?   I'd really like to understand how I can calculate based on the sub total vs. the grand total.    I am trying to use the information provided earlier in this post, however, I believe the solution provided is intended for calculating and summing $$.   I am working with whole #'s, not dollar amounts.

Hi @Anonymous,

 

Have you tried the solution provided above? Does it work in your scenario? If it works, could you accept it as solution to close this thread?

 

If you still have any question on this issue, feel free to post here. Smiley Happy

 

Regards

Anonymous
Not applicable

I have tried the solution provided but was not as successful.   I will try to share out.   Currently I am unable to share from my personal drive to others outside the company.  

tringuyenminh92
Memorable Member
Memorable Member

Hi @Anonymous,

 

I think your concern looks like this question , so the idea is using ALLSELECTED subtotal, you could refer my topic Percent of subtotal/groups in Power BI for details.

 

If this works for you please accept it as solution and also like to give KUDOS.

Best regards
Tri Nguyen

CheenuSing
Community Champion
Community Champion

HI @Anonymous

 

 

Can you share the pbix file in the One Drive and share the link to check out.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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