Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |