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
WNA247365
Frequent Visitor

Calculate percentage of total for matrix column

Hi, I have a matrix table where I want to have a value that gives the percentage for the column value for the row.    For example I have the following matrix table like the following:

 

Date Received:  | 2016-08-28

Delivered          | Samples         Relative%

--------------------------------------------------

Before 12          |       7                 0.12%

Before 3            |    122                2.09%

Before 5            |    192                3.29%

Before 7            |     807              13.82%

 

There are columns for 7 days so there columns and values for 6/28, 6/29, 6/30.....

My issue is that the Relative% column is the percentage for all the days and I just want it to be for that day.  I'd want "Before 7" to be 71.54%  I know that somehow I need to restrict the calculation to the context of the column instead of the entire dataset but I can't find how to do that.  I've tried several variants of calculate with counts and various filters but can't seem to figure it out.  Thanks in advance for any help

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

hi @WNA247365

 

Try this measure:

 

% Relative =
DIVIDE (
    CALCULATE ( SUM ( Tabla1[Samples] ) );
    CALCULATE ( SUM ( Tabla1[Samples] )ALLEXCEPT ( Tabla1; Tabla1[Date Recieved] ) )
)

 

 




Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

hi @WNA247365

 

Try this measure:

 

% Relative =
DIVIDE (
    CALCULATE ( SUM ( Tabla1[Samples] ) );
    CALCULATE ( SUM ( Tabla1[Samples] )ALLEXCEPT ( Tabla1; Tabla1[Date Recieved] ) )
)

 

 




Lima - Peru

Thank you very much Vvelarde!  Works perfectly.  My final measure calc was this:

 

Relative2 = Format(divide(calculate(counta('qrySpecimenTracking\'[Delivered])),CALCULATE((COUNTA('qrySpecimenTracking\'[Delivered])),ALLEXCEPT('qrySpecimenTracking\','qrySpecimenTracking\'[Date Received]))),"0.00%")

 

I just could not get that filter right :-).  Thanks again for you help and the quick reply!

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.