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
Anonymous
Not applicable

Calculate percentage of total for matrix column

Hi,

 

I have data displayed in a matrix:

 

Percentage of column.PNG

 

(I removed sensitive first column, but there is a first column with product names)

 

Here is the  definition of the matrix:

Definición de matriz.PNG

 

What I want to do is that every column percentage sums 100% at the bottom, My tries always gives as the percentage of the whole data.

 

My variable definition is as follows:

 

% Bat Presencia = var paso1= CALCULATE(SUM('BATERÍAS'[Veces]),ALLSELECTED()) return sum('BATERÍAS'[Veces])/paso1

 

This works nice when there is one column.

 

Help is greatly appreciated.

2 ACCEPTED SOLUTIONS

@Anonymous

 

% Bat Presencia =
VAR paso1 =
    CALCULATE (
        SUM ( 'BATERÍAS'[Veces] ),
        ALLEXCEPT ( 'BATERíAS', 'BATERíAS'[Medicion] )
    )
RETURN
    SUM ( 'BATERÍAS'[Veces] ) / paso1



Lima - Peru

View solution in original post

@Anonymous

 

You can't remove other filters in table1, but keep a column for context filter from table2 reserved. Even you have built the relationship between two tables, it will return entire table1 as context without taking the values from [MEDICION] column. You have to put the [MEDICION] into table1 to group your calculation as you have done.

 

Regards,

 

View solution in original post

5 REPLIES 5
Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, if i understand correctly

 

Do You need every column Sum 100% and each row the Correct %. Example: (12483/19003)=65.7%




Lima - Peru
Anonymous
Not applicable

That is correct, I need that the percentages shown total 100% en every column.

 

Regards,

@Anonymous

 

% Bat Presencia =
VAR paso1 =
    CALCULATE (
        SUM ( 'BATERÍAS'[Veces] ),
        ALLEXCEPT ( 'BATERíAS', 'BATERíAS'[Medicion] )
    )
RETURN
    SUM ( 'BATERÍAS'[Veces] ) / paso1



Lima - Peru
Anonymous
Not applicable

Fixed!!!

 

With your proposed solution a got 100% on every row of the table, my measure "MEDICION" comes from another table. I moved MEDICION to the analysis table and now it is fixed. I do not have the time to figure out why a valid related column from another table was causing the problem.

 

Thank you!!!

@Anonymous

 

You can't remove other filters in table1, but keep a column for context filter from table2 reserved. Even you have built the relationship between two tables, it will return entire table1 as context without taking the values from [MEDICION] column. You have to put the [MEDICION] into table1 to group your calculation as you have done.

 

Regards,

 

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