Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Calculated column based on unique text values in another column.

I have a column with two unique text values available. I would like to use this column to create a new calculated column which displays a rate based on the two unique text values

 

The table looks like this:

Name                 Win?

Person1               Win

Person1               Win

Person1               Lose

Person2               Lose

Person2               Win

 

I would like to create a new column so that I can display the data like this:

Name                  Win Rate

Person1                66%

Person2                50%

 

I've tried to use Calculated functions but continue to receive error messages such as "Cannot convert value 'Win' of type text to type True/False'. Thank you for any help!

  • Hi Anonymous 

    Try this, where Table1 is the first table you show:

    1. Place Table1[Name] in the rows of a matrix visual

    2. Create this measure and place it in values of the matrix visual:

    Win Rate =
    DIVIDE (
        CALCULATE ( COUNT ( Table1[Win?] ), Table1[Win?] = "Win" ),
        COUNT ( Table1[Win?] )
    )

     

1 Reply

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    Try this, where Table1 is the first table you show:

    1. Place Table1[Name] in the rows of a matrix visual

    2. Create this measure and place it in values of the matrix visual:

    Win Rate =
    DIVIDE (
        CALCULATE ( COUNT ( Table1[Win?] ), Table1[Win?] = "Win" ),
        COUNT ( Table1[Win?] )
    )