Forum Discussion

TravianMcNavian's avatar
TravianMcNavian
Regular Visitor
4 years ago
Solved

Adding A Percentage Column To A Matrix

Greetings,

I hope you are having a blessed day!

I am attempting to add a percentage summary to the end of a matrix in my PowerBI report.

 

My current Matrix looks like this:

 

Group FPTotal
A012820
B14510
C12710
D 7815
E17210
R113620
Total4453685

 

I ultimately want the matrix to look like this:

 

GroupPF TotalPass Percent
A81202040%
B5411050%
C7211070%
D87 1553%
E2711020%
R61312030%
Total3645485--

 

My intuition is that this problem can be solved via a measure, I have tried generating a measure using the following DAX expression:

PassRate =
DIVIDE (
    COUNTROWS ( FILTER ( Query1, Query1[Pass] = "P" ) ),
    CALCULATE ( COUNTROWS ( Query1 )ALL ( Query1 ) )
)

 

However when I try to use the above code, and add it to the Columns or Values field, the table breaks and is filled with 0%s.

 

What is a way I can add a Percentage column to the first Matrix?

 

 

  • Hi,

    If you want to create a column, that is calculated the percentage value of passing based on each row, you could use below code ("Column 4" is the column without any title in your message) :

    Pass percent = divide( [P], ([P] + [F] + [Column4] ))

     

4 Replies

  • MahyarTF's avatar
    MahyarTF
    Memorable Member

    Hi,

    If you want to create a column, that is calculated the percentage value of passing based on each row, you could use below code ("Column 4" is the column without any title in your message) :

    Pass percent = divide( [P], ([P] + [F] + [Column4] ))

     

  •  Hi
    What is the below column? 
    Group
     What is this column ?
    F
    P
    Total
    A
    0
    12
    8
    20
    B
    1
    4
    5
    10
    C
    1
    2
    7
    10
    D
     
    7
    8
    15
    E
    1
    7
    2
    10
    R
    1
    13
    6
    20
    Total
    4
    45
    36
    85
     
    Do you have screen shot of data?
    • TravianMcNavian's avatar
      TravianMcNavian
      Regular Visitor

      Greetings,

      The column without values is a blank column.

      Some sample data is reproduced in the table in this message:

      AP
      AP
      AF
      B 
      C 
      DF
      R 
      E 
      AP
      BP
      CP
      DF
      EF
      RF
      RF
      RF
      DF
      AF
      AF
      AF
      BF
      CP
      DP
      RP
      EF
      AF
      BF
      CF
      DF
      EF
      RF
      RP
      RP
      DP
      AP
      AF
      AP
      BP
      CP
      DF
      RF
      EF
      AF
      BF
      CP
      DP
      EP
      RF
      RF
      RF
      DF
      AF
      AF
      AF
      BP
      CP
      DP
      RP
      EF
      AP
      BP
      CP
      DF
      EF
      RF
      RF
      RF
      DP
      AP
      AP
      AF
      BF
      CF
      DF
      RF
      EF
      AF
      BP
      CP
      DP
      EP
      RF
      RP
      RP
      DP


      Warm Regards,
      ~Travian

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi TravianMcNavian,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng