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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
New_be
Helper V
Helper V

Sum of Percentages of Subgrouping

Hi Everyone, 
i have a problem to get a correct sum of percentages for my project. I will show in details below;
Section.PNG

I have a column named section as u can see in the image. Then i try to group this section like in another image below;
SectionG.PNG

I also have a measure for YDA (yesterday), 

REJECT_YDA =
--
CALCULATE( DIVIDE( [TOTAL_REJECT], [TOTAL_PRD] ),
USERELATIONSHIP( 'Calendar'[DATE], RRB[Date (7-7)] ), 'Calendar'[Yesterday Equal Today] = TRUE() )

i use userelationship because in data model, this connection is inactive.
PercentCompare.PNG
So as u can see, the Sum of percentage for TOTAL BLOCK C is incorrect because if we plus all the values inside the red circle, the correct value will be 0.19 %. Anyone know how to solve this? Really appreciate your solution & thanks in advance

1 ACCEPTED SOLUTION

Hi @New_be ,

 

Change your %Total Reject Measure to this.

 

% Total Reject =
SUMX(
Movement,
DIVIDE( [Total Reject], [Total PRD] )
)
 
 
1.jpg
 
Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

11 REPLIES 11
amitchandak
Super User
Super User

@New_be , to me this seems correct formula, Can you put the [TOTAL_REJECT] and  [TOTAL_PRD] next to REJECT_YDA. Because one of them might have subtotal issue

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

https://www.youtube.com/watch?v=AJxCCfFmLTQ

i try to follow like in this video. But seems like i make some mistake. Below is my code;

My code: 

REJECT_YDA Test =
--
VAR SectionGroup = VALUES('Sections'[Section (groups)])
VAR Section = VALUES('Sections'[Section])
--
--
VAR TotalProduction =
SWITCH( TRUE(),
            ISINSCOPE('Sections'[Section (groups)]), CALCULATE([TOTAL_PRD], ALLSELECTED('Sections'), 'Sections'[Section         (groups)] IN SectionGroup, 'Sections'[Section] IN Section),
           ISINSCOPE('Sections'[Section]), CALCULATE( [TOTAL_PRD], ALLSELECTED('Sections') ) )
--
--
RETURN
IF( ISINSCOPE('Sections'[Section]),
        CALCULATE( DIVIDE( [TOTAL_REJECT], TotalProduction ),USERELATIONSHIP( 'Calendar'[DATE], RRB[Date (7-7)]        ),'Calendar'[Yesterday Equal Today] = TRUE()), 1)
 
amc_2.PNG
But as u see, my value doesnt go as smooth as in the video
 
Anonymous
Not applicable

HI @New_be,

Can you please share a part of dummy data with a similar data structure and expected result? It will help to test coding formula on it. How to Get Your Question Answered Quickly 

In addition, you can also take a look at the following link about measure total calculations if it meets your requirement:

Measure Totals, The Final Word 

Regards,

Xiaoxin Sheng

Hi, here is my sample dummy data 
https://we.tl/t-J4nnwiFkxD

Hi @New_be ,

 

Change your %Total Reject Measure to this.

 

% Total Reject =
SUMX(
Movement,
DIVIDE( [Total Reject], [Total PRD] )
)
 
 
1.jpg
 
Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@harshnathani  Whit if i use a TOTALYTD function? can it also be calculate like that? 
Here is my YTD calculation;

 

REJECT_YTD =
VAR _max =
MAXX( ALLSELECTED(RRB), RRB[DATE_ORG] ) - TIME(07,00,00)

RETURN
TOTALYTD( DIVIDE([TOTAL_REJECT], [TOTAL_PRD]),
RRB[DATE_ORG], RRB[DATE_ORG] <= _max )

Hi, can i get your email for me to send u a dummy data?

@New_be , I see most of the values wrong as divide has some extra filter na relation.

Check with these two measures

CALCULATE( [TOTAL_REJECT] ,
USERELATIONSHIP( 'Calendar'[DATE], RRB[Date (7-7)] ), 'Calendar'[Yesterday Equal Today] = TRUE() )

CALCULATE([TOTAL_PRD] ,
USERELATIONSHIP( 'Calendar'[DATE], RRB[Date (7-7)] ), 'Calendar'[Yesterday Equal Today] = TRUE() )

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

Mr. Amit, here is the link to dummy data 
https://we.tl/t-J4nnwiFkxD

Hi Mr. Amitchandak,
can i get your email to send u a small dummy data in ppbix?

amc_1.PNG

Here the values. But sum of percentages does not sum like the actual sum. For example, TOTAL BLOCK AB should get 0.05% instead of 0.03%

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors