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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

How to calculate sum using IF function

Hello.
I would like to know if there is a way to do sum when using the IF function. Below is an example of my problem 

Screenshot 2023-07-24 141851.png

 
I have three metrics:
Today, Today 1 and Today 3, for every metrics there is a goal. To count who achieved the goal and who didn't, I used the logic below:

 

Test Logic = IF([Today]>=[Goal],1,0)
Test Logic 1 = IF([Today 1]>=[Goal 1],1,0)
Test Logic 2 = IF([Today 2]>=[Goal 2],1,0)
 
To sum all of this I used below formula:
Test Logic Sum = [Test Logic] + [Test Logic 1] + [Test Logic 2]
 
This allow me to sum numbers in rows but I still have it a problem with sum a columns.
 
Test Logic should be 2
Test Logic 1 should be 2
Test Logic 2 should be 4
 
To calculated Score I used this formula:
 
Test Logic Sum = DIVIDE([Test Logic] + [Test Logic 1] + [Test Logic 2],3,0)
 
Is there is a better to way to calculate this numbers correct ?
 
Regards Piotr.
1 REPLY 1
Manoj_Nair
Solution Supplier
Solution Supplier

@piotrgrendus87- Did you tried using this. I just made a small changes in your proposed DAX measure. Let me know if this works.

Test Logic Average = DIVIDE([Test Logic Sum], 3, 0)

 

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.