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
GerlofVisser
Helper I
Helper I

Using SumX with If Statements

Hi,

 

I am having difficulties with summing up my analysis using multiple If statements and measures.

I'm trying to define how much of my missed production (MP) is coming due to operational errors. These can be defined by; if 0<uptime<1 (except when covid) then operational error and all the missed production should be attributed to this measure (see MP_ops measurement).

Basically it works fine, but then when I want to sum it up on a monthly/yearly basis, the result remains zero.

Therefor I thought, I should be using sumx, so my final measure is 

 

MP_ops_sum = sumx(flow_data_forecast,[MP_Ops])

 

 And from the table below you can see that I then get monthly/yearly totals.

However at some days, there is no missed production according to my IF statements (MP_Ops), but then when using the sumx function, there is some missed production.

I am working with quite some measures, but I think these are all working fine and I believe the error lies in the last measure; MP_ops.

 

GerlofVisser_1-1599053972275.png

 

 

 

This is my code 

 

MP_Ops = if([Total Missed Production]>0, if([MP_Covid]>0,0,if([Uptime_Field]=0 , [Total Missed Production], if([Uptime_Field]<1,if([MP_Correction]>[Total Missed Production]||[MP_Correction]=0,[Total Missed Production],[MP_Correction]),0))),0)
MP_Correction = [Total Gross Sales boe]/[Uptime_Field]-[Total Gross Sales boe]

 

 

Any help is really appreciated.

 

Regards,

Gerlof

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@GerlofVisser , Try like

MP_ops_sum = sumx(values(flow_data_forecast[Date]),[MP_Ops])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@GerlofVisser , Try like

MP_ops_sum = sumx(values(flow_data_forecast[Date]),[MP_Ops])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Wow, that did the trick and it seemed like an easy fix!

 

Thanks!

 

Can you explain a bit more on this or direct me to an explanation page?

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.