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
Mart
Advocate IV
Advocate IV

Pecentage in a matrix with grouping Help

using this:

percent = DIVIDE(SUM('Table1 (2)'[People]), CALCULATE(COUNT('Table1 (2)'[People]),ALLEXCEPT('Table1 (2)','Table1 (2)'[People])))

 

I was able to get a percentage but the calculation needs to work within the first group.  Otherwise the percentage is wrong as it works on the total of people and not the sub totals.

 

How do get the calculations to work within groups?

 

ie                           Y1                  Y2                     Y3

Group  JOB   people    %        people   %        people    %

first       1        50        50

             2        50        50

          Total    100       100

Second  3        75        75

             4        25        25

          Total    100       100

Total              200

 

 

6 REPLIES 6
v-caliao-msft
Microsoft Employee
Microsoft Employee

Hi @Mart,

 

You could use the DAX below.

Measure = sum(Table2[Amount])/CALCULATE(SUM(Table2[Amount]),ALLEXCEPT(Table2,Table2[Group]))

Sample data
Capture.PNGCapture1.PNG

 

Regards,

Charlie Liao

Charlie

 

Thats ecactly what I want, but I cant repeate it I will start again from scratch.

Could it be because I have it in a matrix?

 

Mart

@Mart, Could you please provide us more information why you cannot do it? If possible providue us some screenshot, so that we can make further analysis.

 

Regards,

Charlie Liao

Cracked it! At least I have the correct numbers


I used 3 new measures

First New Measure

GrandTotal = CALCULATE(SUM(Table2[People]),GROUPBY(Table2,Table2[Group]),ALLEXCEPT(Table2,Table2[Year],Table2[People]))

Second New Measure

PeopleSum = SUM(Table2[People])

Third New Measure

Percent = Table2[PeopleSum]/Table2[GrandTotal]


Question

Is there an easier way?

 

Vvelarde
Community Champion
Community Champion

@Mart

 

hi, you need to modified the AllExcept, Just mantain the filter Group and it works

 

% =
    DIVIDE (
        CALCULATE ( COUNT ( Table1[People] ) ),
        CALCULATE ( COUNT ( Table1[People] ), ALLEXCEPT ( Table1,Table1[Group] ) )
    )



Lima - Peru

Thanks Victor

 

Almost there but percentage still wrong after first total row, you can't have more than 100%

 

Will try to upload new image

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors