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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Calculation on IF statement

Hello Power BI Community,

 

Am fairly new with PBI, and I would love to know your thoughts on this problem am coming across.

 

I have done an IF calculation on my organization dataset and I am coming across a problem of summing the result of my IF statement.

 

IF Statement Formula:

 

IF([Quality%] >= 0.7, 1,0)

 

Mobafa_0-1647287959572.png

 

How would I be able to sum the 2nd column and devide over the numbers of days?

 

Any help is greatly appreciated!

 

Thank you,

Mohammed

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

Since your IF Statement is a measure, you could try to create a summarized table ,then use SUMX() to get the count when =1:

 

Measure =
var _t= SUMMARIZE('Table','Table'[Date],"If",[IF Statement])
return SUMX(_t,[If]) 
Eyelyn9_0-1647482391504.png

Then you could use DIVIDE() , COUNTROWS() to get final output.

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @Anonymous ,

 

Since your IF Statement is a measure, you could try to create a summarized table ,then use SUMX() to get the count when =1:

 

Measure =
var _t= SUMMARIZE('Table','Table'[Date],"If",[IF Statement])
return SUMX(_t,[If]) 
Eyelyn9_0-1647482391504.png

Then you could use DIVIDE() , COUNTROWS() to get final output.

 

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi Eyelyn9,

 

Thank you, this worked great with me.. appreciate the help.

 

Regards,

Mo

Anonymous
Not applicable

Hi @tackytechtom 

 

Unfortunatly it didn't work. I believe SUM(YourIfStatementColumns) is not allowed due to the nature of The IF Statement.

 

Note that this IF statement is a measure and not part of the datatable. Am guessing PBI isn't adaptable to SUM Logical Values results which cause this problem.

 

Hope this helps in finding alternative solutions.

 

Thank you in advance!

Mo

tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about something like this:

YourMeasure =
DIVIDE ( SUM ( 'YourTable'[YourIfStatementColumn] ), COUNTROWS ( 'YourTable' ) ) 

 

Does this solve your issue? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors