The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I am trying to calculate a cumulative/running total using:
Running Invoiced Amounts =
VAR CurrentDate = MAX(AR_Balances[GL Date])
RETURN
CALCULATE(
SUMX(AR_Balances, AR_Balances[Invoice Amount]),
FILTER(
ALL(AR_Balances),
AR_Balances[GL Date] <= CurrentDate
)
)
GL Date* | Invoice Amount | Cumulative Total |
1-Jan-22 | 100 | 1,050 |
15-Jan-22 | 200 | 1,250 |
... | ... | ... |
31-Dec-22 | 200 | 1,450 |
1-Jan-23 | 250 | 1,700 |
... | ... | ... |
27-May-23 | 300 | 2,200 |
Total | 1,050 | 3,050 |
*GL Date = Invoice Date
Problems I am unable to fix::
1. Starting of cumulative total (1,050) is the sum of all invoices (total). Why and how to prevent so?
2. Cumulative total seemingly works (if starting 1,050 is ignored), but I expect it to reset as soon as the year changes on 31-Dec. How to achieve this?
Thanks.
Can you share your PBI?
Nopes. Apologies.
Update:
I have managed to fix the first issue where cumulative total started with the sum of all invoices (i.e. 1,050) using below DAX. Please help me with the second problem. Thanks:
Solution to # 1:
Running Invoiced Amounts =
VAR CurrentDate = MAX(AR_Balances[GL Date])
RETURN
CALCULATE(
SUMX(AR_Balances, AR_Balances[Invoice Amount]),
AR_Balances[GL Date] <= CurrentDate
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
19 | |
18 | |
17 | |
12 |
User | Count |
---|---|
36 | |
34 | |
20 | |
19 | |
15 |