Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I recently read that you should not use the EARLIER function. I recently inherited a dataset file that uses this function and it keeps crashing, likely due to the EARLIER function. I am trying to convert this formula into the proper format using variables but I'm having some trouble.
The current code is set up like so to get the cumulative balance as of the most recent invoice. How can I adjust this to remove the EARLIER function but get the same result?
_Balance Cumulative =
calculate(sum(Invoices[Balance]),
ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
filter(
all(Invoices[Invoice Date]),Invoices[Invoice Date] <=
EARLIER(Invoices[Invoice Date])))
Solved! Go to Solution.
Hi @jludwick ,
If you want to create a calculated column, you can try:
_Balance Cumulative =
var _a=Invoices[Invoice Date]
return
calculate(sum(Invoices[Balance]),
ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
filter(
all(Invoices[Invoice Date]),Invoices[Invoice Date] <= _a
))
If you want to create a measure, you can try:
_Balance Cumulative =
calculate(sum(Invoices[Balance]),
ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
filter(
all(Invoices[Invoice Date]),Invoices[Invoice Date] <=
MAX(Invoices[Invoice Date])))
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
In a calculated column, it's highly recommended to use VAR to subsitute for EALIER/ERLIEST for better readability and maintainability,
_Balance Cumulative =
VAR __dt = Invoices[Invoice Date]
RETURN
CALCULATE(
SUM( Invoices[Balance] ),
ALLEXCEPT( Invoices, Invoices[Customer ID + Company Desc] ),
Invoices[Invoice Date] <= __dt
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Hi @jludwick ,
If you want to create a calculated column, you can try:
_Balance Cumulative =
var _a=Invoices[Invoice Date]
return
calculate(sum(Invoices[Balance]),
ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
filter(
all(Invoices[Invoice Date]),Invoices[Invoice Date] <= _a
))
If you want to create a measure, you can try:
_Balance Cumulative =
calculate(sum(Invoices[Balance]),
ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
filter(
all(Invoices[Invoice Date]),Invoices[Invoice Date] <=
MAX(Invoices[Invoice Date])))
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 21 | |
| 10 | |
| 7 | |
| 7 |