Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am working with a stream of payments for a given invoice. What I am trying to do is show a running balance of invoices.
Here is what my data looks like:
Invoice | Date | Payment Type | Payment | Aging Group | |||||
1A1 | 1/1/2020 |
| Invoice | 1000 | Current | ||||
1A1 | 1/4/2020 | Cash Received | -500 | 1-30 Days Past Due | |||||
1A1 | 1/5/2020 | Cash Received | -500 | 1-30 Days Past Due | |||||
1B1 | 2/4/2020 | Invoice | 2000 | Current | |||||
1B1 | 2/5/2020 | Cash Received | -1500 | 1-30 Days Past Due | |||||
1B1 | 2/20/2020 | Cash Received | -250 | 1-30 Days Past Due | |||||
1B1 | 2/21/2020 | Cash Received | -200 | 1-30 Days Past Due | |||||
1B1 | 3/1/2020 | Cash Received | -50 | 1-30 Days Past Due |
Here is the calculation I am using for the running balance:
Payment Stream = SUM('Current State'[Payment])
Running Balance =
var max_date = MAX('Dates - Dim Dates'[Calendar Date]
RETURN
Calculate([Payment Stream],
EDIT: To clarify, the goal is to show the invoiced amount on a stacked chart on the date it occurs. That bar remains on the chart for every day until there is a payment. If the payment is in full then the original invoiced amount goes to 0 and the bar disappears. If there is only partial cash payment, then the bar goes down by the amount of cash received. So, for 1A1, the invoiced amount of $1000 would be on the chart from 1/1/2020 to 1/3/2020. On 1/4/2020 there is a cash payment so the bar goes down by the amount of the cash payment. Ideally, this then would be sliced with the aging groups to show an Accounts Receivable balance over time.
Solved! Go to Solution.
Hi @sjrrkb123,
For your scenario, I'd like or suggest you create an unconnected calendar table and use the following measure expression to replace the display value based on the new calendar date and current payment type.
New calendar:
Unconnected = VALUES('Dates - Dim Dates')
Measure expressions:
Rolling =
VAR max_date =
MAX ( 'Unconnected'[Calendar Date] )
RETURN
SWITCH (
SELECTEDVALUE ( 'Current State'[Payment Type] ),
"Invoice",
CALCULATE (
SUM ( 'Current State'[Payment] ),
FILTER ( ALLSELECTED ( 'Current State' ), [Date] <= max_date )
),
CALCULATE (
ABS ( SUM ( 'Current State'[Payment] ) ),
FILTER ( ALLSELECTED ( 'Current State' ), [Date] <= max_date ),
VALUES ( 'Current State'[Payment Type] )
)
)
Regards,
Xiaoxin Sheng
Hi @sjrrkb123,
For your scenario, I'd like or suggest you create an unconnected calendar table and use the following measure expression to replace the display value based on the new calendar date and current payment type.
New calendar:
Unconnected = VALUES('Dates - Dim Dates')
Measure expressions:
Rolling =
VAR max_date =
MAX ( 'Unconnected'[Calendar Date] )
RETURN
SWITCH (
SELECTEDVALUE ( 'Current State'[Payment Type] ),
"Invoice",
CALCULATE (
SUM ( 'Current State'[Payment] ),
FILTER ( ALLSELECTED ( 'Current State' ), [Date] <= max_date )
),
CALCULATE (
ABS ( SUM ( 'Current State'[Payment] ) ),
FILTER ( ALLSELECTED ( 'Current State' ), [Date] <= max_date ),
VALUES ( 'Current State'[Payment Type] )
)
)
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
97 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |