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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate sum(EAC) row by row of 3 columns based on condition

Hi ,

 

I am new to Power BI.

I want to calculate EAC of all rows, for whole column.

 

For example:

 ForecastActualForecastActualForecastActual 
 JanJanFebFebMarMarEAC
1$10$15$67$33$780$126
2$15$23$34$24$34 $81
3$15$10$54$54$210$85
4$23$22$32$21$76 $119
5$20$45$87$23$56 $124
6$54$35$65$87$720$194

In the above column I want to calculate EAC, but the logic here is, we have got actuals till Feb, so the EAC will be-

Jan Actuals+Feb Actuals +Mar Forecast.

 

Similarly, if Feb Actuals would have been zero, the Formula would be :- Jan Actuals + Feb Forecast +March Forecast.

 

I need a formula to check first if Feb or march contains all rows as zero or null in the whole, and then calculate based on that.

Or if we can have a user input to select the month till which we have got actuals, so that EAC will be calculated on that basis.

 

Please help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, 

Thanks it worked. 🙂

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

I had dumped the values from your sample and created the table(table1) and created a measure with the below formula to calculate the EAC,

EAC = SWITCH(true(),
            IF(ISBLANK(Sum(Table1[Actual Jan])),0,Sum(Table1[Actual Jan]))=0,sum(Table1[Forecast Jan])+SUM(Table1[Forecast Feb])+Sum(Table1[Forecast Mar]),
            IF(ISBLANK(Sum(Table1[Actual Feb])),0,Sum(Table1[Actual Feb]))=0,sum(Table1[Actual Jan])+SUM(Table1[Forecast Feb])+Sum(Table1[Forecast Mar]),
            IF(ISBLANK(Sum(Table1[ActualMar])),0,Sum(Table1[ActualMar]))=0,sum(Table1[Actual Jan])+SUM(Table1[Actual Feb])+Sum(Table1[Forecast Mar]),
            sum(Table1[Actual Jan])+SUM(Table1[Actual Feb])+Sum(Table1[ActualMar]))

 

 

Anonymous
Not applicable

Hi, 

Thanks it worked. 🙂

 

 

Anonymous
Not applicable

Hi,

Can we create calculated columns using the above same formula from Measure.

 

Cause when I use the same formula, I am not getting the correct numbers.

 

 

Appreciate your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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