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
Anonymous
Not applicable

How to only add up True values in a column

Hello

 

I have a calculated column where it returns "true" if the budget column is below budget. I am trying to understand the % of projects (rows) that are under budget compared to the total amount of rows.

 

How do I add up only the "true" rows in a column, so that I can divide by the total number of rows? this would give me the % of projects under budget vs total projects.

 

I did this formula, but I don't believe it is accounting for only the "true" results

 

Count of On_UnderBudget divided by Count of Store Number =

DIVIDE(

                COUNTA('CML-Filtered'[On_UnderBudget]),

                COUNTA('CML-Filtered'[Key])

))

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey,

 

give this a try it should do what you're after:

 

Count of On_UnderBudget divided by Count of Store Number = 

divide(

calculate(counta('CML-Filtered'[Key]),'CML-Filtered'[On_UnderBudget] ="true"),

calculate(counta('CML-Filtered'[Key]))

)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

You can count the true/False using countrows.

 

CALCULATE(COUNTROWS(Table1),Table1[True_False_Col]=TRUE())

 

 

Thanks
Raj

Anonymous
Not applicable

Hey,

 

give this a try it should do what you're after:

 

Count of On_UnderBudget divided by Count of Store Number = 

divide(

calculate(counta('CML-Filtered'[Key]),'CML-Filtered'[On_UnderBudget] ="true"),

calculate(counta('CML-Filtered'[Key]))

)

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.