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
mariannacarbo
Regular Visitor

Percent of row total of count values

Hi all,

 

Im very new using Power Bi. I have a database showing corrective maintenance (PM02) in diferente range of time since them were opened. The values ar from database calulated with count (distinct) I want to show in a matrix the percent of row total but shows always 100%. At the next image, I'm showing the matrix representing the percent of column total. I need this measure but in row. Anyone can help me, please?

mariannacarbo_1-1631332202573.png

 

Thanks in advance.

1 ACCEPTED SOLUTION

Thanks @mariannacarbo for the additional info and sample data - do you have column headers and table name please? 

 

See attached file below signature - % of row total works fine for me in my test, I have also included a DAX measure you can use to acheive the same result: 

 

% of Row Total On Time Status =
VAR _RowTotal = CALCULATE(COUNT('Table'[Task ID]), ALL('Table'[On Time Status]))
RETURN
DIVIDE(COUNT('Table'[Task ID]), _RowTotal)

 

AllisonKennedy_0-1631485609687.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

6 REPLIES 6
AllisonKennedy
Super User
Super User

@mariannacarbo In order to get Percent of Row total to work, you must put something in the 'Columns' section of the matrix visualization. You appear to be using many different measures in the 'Values' section, but nothing in 'Columns' section. Therefore the % of Row Total always shows as 100%

 

If you can paste a sample of first 10 or so rows of raw data and explain what percent value you want displayed as the row total (or do the calculation in Excel and show us the formulas), then we can help you with the DAX for this. 

 

Do you want the percent as weeks? You could try putting Week Number in Columns and Show Values on Rows turn that to 'On' by clicking the format paint roller when the matrix visual is selected. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy 

 

I tried putting the weeks in the field of colums but it shows to 100%. At the following tables I show you in Excel what I need:

 

The visual show this in no calculation.The visual that I need in order to do conditional format
 PM02 ON TIMEPM02 - 30PM02 - 60PM02 - 90 WEEKPM02 ON TIMEPM02 - 30PM02 - 60PM02 - 90
30 4   30 100%  
32 3   32 100%  
3312   3333%67%  
3433   3450%50%  
35512   3529%71%  

 

This 10 rows of the raw data:

G51482002421571000104920001087PM02"Hand truck"#497607 se apaga0047-010BEVERAGE BASE|CIDRA 2.00.000NEWREL  NMAT PRC  SETC0010E09/09/2021 MF1 PRF980P1909/09/202109/10/20219/12/20213On Time
A58781500196211000042020000238PM0204-026 no da marcha0047-050-020-57064-FORK LIFT NO.04-026 CROWNFORK LIFT CROWN FC-4040-60-TT1880.00.000NEWREL  PRT  GMPS MACM PRC  SETC0010E09/06/2021 MF1 PRF980P1908/06/202109/06/20219/12/20213630
E40922000000001000015120000261PM0233393585 SALIDERO DE AGUA FRIA EN COIL G0047-040-070-000-20008-AHU MIXING ROOM 2UNIT AIR HANDLING TRANE MCCB035VA0A0VA0.00.000NEWREL  MACM PRC  SETC0010E07/29/2021 MF1 PRF110P1907/27/202107/29/20219/12/20214545
E40922000000001000017020000300PM0233406649 5S TALLER MECANICOS DE MANUFACT0047-060-010-060-34059-SHOP WELDING PRODUCTION 0.00.000NEWREL  GMPS MACM PRC  SETC0010E07/29/2021 MP1 PRM620P1907/27/202107/29/20219/12/20214545
E40922000601121000015220000262PM0233445324 Carrito de PIAB para el mezzani0047-020-08029-MEZZANINE 3 2.00.000NEWREL  MACM PRC  SETC0010E09/05/2021 MP1 PRM620P0107/27/202109/05/20219/12/20214545
E40922000000001000015320000263PM0233462353 REPARACION DE CHILLER #3 O688570047-040-040-02057-CHILLER TRANE NO.3 CVHE045 350 TONSCHILLER TRANE CVHE0450.00.000NEWREL  MACM PRC  SETC0010E07/29/2021 MF1 PRF110P1907/27/202107/29/20219/12/20214545
G67716000481161000076420000842PM0233505619 TORQUIMETRO  SERAC 1 SIN BOTON0047-030-030-45014-TORQUE TESTERTORQUE TESTER KAPS-ALL EB-650A4.50.000WECTECO CNF  GMPS JBFI MACM PRC  SETC0010E09/09/202108/24/2021MP1 PRM100P1908/24/202109/09/20219/12/202118On Time
E40922000000001000015420000264PM0233517231 REEMPLAZO DE ASCO TUBE G677080047-010-000-12009-CENTRIFUGE POD CE-09-138-00CENTRIFUGE APV B10,POD#20.00.000NEWREL  MACM PRC  SETC0010E09/05/2021 MP1 PRM620P1907/27/202109/05/20219/12/20214545
E40922000000001000019020000320PM0233517886 SANDBLASTING Y PINTURA SUPPLY F0047-040-070-080-00032-SUPPLY FAN TWIN CITY 1FAN SUPPLY TWIN CITY  SF # 10.00.000NEWREL  MACM PRC  SETC0010E07/29/2021 MF1 PRF100P1907/27/202107/29/20219/12/20214545
O68857000000001000044720000397PM0233552614 PM - LEV CLEANNING - A0047-040-070-040-08010-DUST COLECTOR TORIT NO.9 B/BASECOLLECTOR DUST TORIT DF-3DF-60.00.000NEWREL  GMPS NMAT PRC  SETC0010E09/14/2021 MF1 PRF110P1908/11/202109/14/20219/12/20213130
G29677010109441000035720000377PM0233564570 REPARACION EN TRASFORMADOR G5140047-040-060-050ELECTRICAL SYSTEM NO.5 8.2 KV 0.00.000NEWREL  MACM PRC  SETC0010E07/31/2021 MF1 PRF301P1907/29/202107/31/20219/12/20214330

Thanks @mariannacarbo for the additional info and sample data - do you have column headers and table name please? 

 

See attached file below signature - % of row total works fine for me in my test, I have also included a DAX measure you can use to acheive the same result: 

 

% of Row Total On Time Status =
VAR _RowTotal = CALCULATE(COUNT('Table'[Task ID]), ALL('Table'[On Time Status]))
RETURN
DIVIDE(COUNT('Table'[Task ID]), _RowTotal)

 

AllisonKennedy_0-1631485609687.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy , I have another doubt.  I need to format conditionally in base of the percent presented in each of the time range in the row of th e weeks.  I don't see how to create diferent  rules at the  4 different option of time range.

 

At the following table I show you how I want to view the color of the values.

mariannacarbo_0-1631492977088.png

 

 

 

@mariannacarbo  Have you resolved this yet?

 

You can try with DAX: 

 

% Format Color =
SWITCH( SELECTEDVALUE(table[On Time Status]

, "On Time", IF( [% of Row Total On Time Status] <=.4, "Red", "Green")

, "30", IF( [% of Row Total On Time Status] <=.3, "Red", "Green")

, "60", IF( [% of Row Total On Time Status] <=.2, "Red", "Green")

, "90", IF( [% of Row Total On Time Status] <=.1, "Red", "Green")

 

Then apply conditional formatting to 'Field Value' and select the % Format Color measure.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thank you very much @AllisonKennedy !!!  Its worked perfectly!! 🙂

 

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.