cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mcds
Regular Visitor

Conditional nested sumifs

Hi experts

 

I am having trouble adding the if statement in bold below:

 

BalanceVAT = if('powerbifinance'[KPI_Code]="816999",'powerbifinance'[Balance_at_Date_Actual]-sumx(FILTER('powerbifinance','powerbifinance'[Date]=EARLIER('powerbifinance'[Date])&&'powerbifinance'[KPI_Code]="940999"),if('powerbifinance'[Balance_at_Date_Actual]>0,'powerbifinance'[Balance_at_Date_Actual],0),'powerbifinance'[Balance_at_Date_Actual]))
 
I get the following error: Too many arguments were passed to the SUMX function. The maximum argument count for the function is 2. The custom column works without the bold if statement.

The purpose of the statement is to only subtract the filtered value in case it is larger than 0. What am I doing wrong?
1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

@mcds , I think one 'powerbifinance'[Balance_at_Date_Actual] is additional

 

check

 

BalanceVAT = if('powerbifinance'[KPI_Code]="816999",'powerbifinance'[Balance_at_Date_Actual]-sumx(FILTER('powerbifinance','powerbifinance'[Date]=EARLIER('powerbifinance'[Date]) && 'powerbifinance'[KPI_Code]="940999" ), if('powerbifinance'[Balance_at_Date_Actual]>0,'powerbifinance'[Balance_at_Date_Actual],0)))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
amitchandak
Super User IV
Super User IV

@mcds , I think one 'powerbifinance'[Balance_at_Date_Actual] is additional

 

check

 

BalanceVAT = if('powerbifinance'[KPI_Code]="816999",'powerbifinance'[Balance_at_Date_Actual]-sumx(FILTER('powerbifinance','powerbifinance'[Date]=EARLIER('powerbifinance'[Date]) && 'powerbifinance'[KPI_Code]="940999" ), if('powerbifinance'[Balance_at_Date_Actual]>0,'powerbifinance'[Balance_at_Date_Actual],0)))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

That did the trick! Thanks 🙂

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors