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
vozniak
Helper I
Helper I

How do I calculate the % of True Responses in a True/False Column

I have a column that determines whether the data in the Employee ID field in another table appears in this table. I managed to figure out to to do the calculation to give me a true/false so if it appears I have a response of True. Now, I need to figure out how to determine the % of True respones.

 

I tried using my normal "% Yes" code, but got an error message that you can't do that with True/False data.

 

% YES = 

DIVIDE ( 

    CALCULATE ( COUNT ( Table[Column] ), Table[Column] = "True" ), 

    CALCULATE ( COUNT ( Table[Column] ), ALLSELECTED ( Table[Column] ) ) 

) 

 

How can I calculate the % of True responses so I can create a visual?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @vozniak

 

Create a new calculated column like this:

NumericBool =
IF ( Table[isTrue] = TRUE (), 1, 0 )

 Then you can apply your formula to this column:

 

 

 

% YES =
DIVIDE (
    CALCULATE ( COUNT ( Table[NumericBool] ), Table[NumericBool] = 1 ),
    CALCULATE ( COUNT ( Table[NumericBool] ), ALLSELECTED ( Table[NumericBool] ) )
)

 

 

 

Regards.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @vozniak

 

Create a new calculated column like this:

NumericBool =
IF ( Table[isTrue] = TRUE (), 1, 0 )

 Then you can apply your formula to this column:

 

 

 

% YES =
DIVIDE (
    CALCULATE ( COUNT ( Table[NumericBool] ), Table[NumericBool] = 1 ),
    CALCULATE ( COUNT ( Table[NumericBool] ), ALLSELECTED ( Table[NumericBool] ) )
)

 

 

 

Regards.

Anonymous
Not applicable

This is great. I am hoping to display this in a card as a percentage. If you have an idea, I am all ears. Thank you!

Thank you a million times! This worked perfectly and I've added it to my list of "go to" code.

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.