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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.