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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
snaseem
Helper I
Helper I

Calculation between Rows with conditions

I have below sample dataset where I am looking for compute outstaning balances.

Invoice is issued against certain services with due date to pay, and cash receipt is issued when we receive the cash against respective invoice(s). It does not has to be per invoice calculation, but overall outstanding balance is fine. There could be instances when we receive the full or partial/no payments.

 

trans_dateTrans_typeInvoice #Due DateAmount
4/24/2023Invoice1015/24/2023100
4/24/2023Invoice2025/24/2023200
4/24/2023Invoice3015/24/2023300
4/24/2023Invoice4015/24/2023400
4/24/2023Invoice5015/24/2023500
6/13/2023Cash Receipt1017/13/2023-100
6/13/2023Cash Receipt2027/13/2023-200
6/13/2023Cash Receipt3017/13/2023-300
6/13/2023Cash Receipt4017/13/2023-400
6/13/2023Cash Receipt5017/13/2023-400

 

Need help how to achieve this. 

5 REPLIES 5
Anonymous
Not applicable

Hi @snaseem 

You can refer to the following calculated column

Differ =
VAR sum_invoice =
    SUMX ( FILTER ( 'Table', [Trans_type] = "Invoice" ), [Amount] )
VAR sum_cash =
    SUMX ( FILTER ( 'Table', [Trans_type] = "Cash Receipt" ), [Amount] )
RETURN
    sum_invoice + sum_cash

Output

vxinruzhumsft_0-1692252733703.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Bmejia
Super User
Super User

Can yo just create a matrix table and drag and drop the Invoice # to Rows, Trans Type to Columns and Amount to Values.  The total will give you the outstanding balance

 


 Updating Media

 

Can we do this with the help of dax? I may need to add some other analysis as well such as avg time to pay the invoice etc.

yes, but if you want to actually type the dax formulas it be something like this 

Invoice = CALCULATE(SUM('Sample'[Amount]),'Sample'[Trans_type]="Invoice")
Cash Receipt = CALCULATE(SUM('Sample'[Amount]),'Sample'[Trans_type]="Cash Receipt")
Outstanding = [Invoice]-[Cash Receipt]
Average = CALCULATE(AVERAGE('Sample'[Amount]))
snaseem
Helper I
Helper I

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.