Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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 @Anonymous, 

 

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 @Anonymous, 

 

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!

Anonymous
Not applicable

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.