Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi
I need to find the highest outstanding per customer in a given period.
In my table I have invoices and payments and of course date, customer number and amount.
Do you have any suggestions?
Solved! Go to Solution.
If you create a measure like
Outstanding Amount =
VAR maxDate =
MAX ( 'Date'[Date] )
VAR invoicedAmount =
CALCULATE (
SUM ( 'Table'[Amount] ),
REMOVEFILTERS ( 'Date' ),
ALLEXCEPT ( 'Table', 'Table'[Customer No] ),
'Table'[Date] <= maxDate,
'Table'[Type] = "Invoice"
)
VAR paidAmount =
CALCULATE (
SUM ( 'Table'[Amount] ),
REMOVEFILTERS ( 'Date' ),
ALLEXCEPT ( 'Table', 'Table'[Customer No] ),
'Table'[Date] <= maxDate,
'Table'[Type] = "Payment"
)
RETURN
invoicedAmount - paidAmount
then your max outstanding amount would be
Max Outstanding = MAXX( VALUES('Date'[Date]), [Outstanding Amount])
If you create a measure like
Outstanding Amount =
VAR maxDate =
MAX ( 'Date'[Date] )
VAR invoicedAmount =
CALCULATE (
SUM ( 'Table'[Amount] ),
REMOVEFILTERS ( 'Date' ),
ALLEXCEPT ( 'Table', 'Table'[Customer No] ),
'Table'[Date] <= maxDate,
'Table'[Type] = "Invoice"
)
VAR paidAmount =
CALCULATE (
SUM ( 'Table'[Amount] ),
REMOVEFILTERS ( 'Date' ),
ALLEXCEPT ( 'Table', 'Table'[Customer No] ),
'Table'[Date] <= maxDate,
'Table'[Type] = "Payment"
)
RETURN
invoicedAmount - paidAmount
then your max outstanding amount would be
Max Outstanding = MAXX( VALUES('Date'[Date]), [Outstanding Amount])
Example 😉
So if the filtered period is 1/3/2022 - 31/3/2022 it should show row 4 and 9
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
24 | |
13 | |
11 | |
10 | |
9 |
User | Count |
---|---|
18 | |
14 | |
14 | |
12 | |
11 |