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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.