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
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors