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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Conditional sum

Hello,

I have the following table:

ENTRYACCOUNTDEBITCREDIT
1422049.560,390,00
14220128.471,870,00
14220215.794,910,00
142220,0049.560,39
142220,00128.471,87
142220,00215.794,91
1422049.560,390,00
14220128.471,870,00
14220215.794,910,00
144100,0049.560,39
144720,00128.471,87
144100,00215.794,91
1522010.000,000,00
1522080.000,000,00
152220,0010.000,00
152220,0080.000,00

 

What I want to obtain is the result of adding the amounts of the debit column of the account 220 and subtracting the amounts of the credit column of the account 222 that have the same number of entry.

 

Thank you very much and best regards.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @Anonymous ,

 

You can use the following DAX to get the desired output

 

Measure = CALCULATE(SUM(Sheet1[DEBIT]), FILTER(Sheet1, Sheet1[ACCOUNT] = 220))-CALCULATE (SUM ( Sheet1[CREDIT] ), FILTER(Sheet1, Sheet1[ACCOUNT] = 222 ))
 
 
 
 
Capture.PNG
 
See the above snapshot where i got the same value.
 
If this reslves your issue.. please accept this as solution and give the kudos.
 
Thanks
Sunil

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

HI @Anonymous ,

 

If your problem is solved then please give the kudos.

 

Thanks

alexvc
Resolver I
Resolver I

I can think of a simple way to achieve this, if your data has always debit on account 220 and credit on account 222. This would be to create a measure "Total" = Debit - Credit. After, you can create a table visualization, filter by these account numbers and add in values your entry numbers and your total.

 

If what you are trying to do is finding any entries with balance this should work

 

AV 

Anonymous
Not applicable

Hello @alexvc ,

Thank you for your helping.

What I want to do is a measure that adds up the total amount of the differences of each account, entry by entry. In this example, it would be to calculate the difference in the entry 14 and in the entry 15 and add the two amounts.

 

      Entry 14: Sum of 220 account is 787.645,34 and sum of 222 account is 393.827,17 and the difference is 393.827,17.

      Entry 15: Sum of 220 account is 90.000,00 and sum of 222 account is 90.000,00 and the difference is 0,00.

      Total sum is 393.827,17.

Thank you and best regards.

Anonymous
Not applicable

Hello @Anonymous ,

 

You can use the following DAX to get the desired output

 

Measure = CALCULATE(SUM(Sheet1[DEBIT]), FILTER(Sheet1, Sheet1[ACCOUNT] = 220))-CALCULATE (SUM ( Sheet1[CREDIT] ), FILTER(Sheet1, Sheet1[ACCOUNT] = 222 ))
 
 
 
 
Capture.PNG
 
See the above snapshot where i got the same value.
 
If this reslves your issue.. please accept this as solution and give the kudos.
 
Thanks
Sunil

@Anonymous ,

 

Just add the measure below.

Measure =
CALCULATE ( SUM ( Table1[DEBIT] ), Table1[ACCOUNT] = 220 )
    - CALCULATE ( SUM ( Table1[CREDIT] ), Table1[ACCOUNT] = 222 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.