Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I just learn what the EARLIER function does. But I found that there is a very similar expression that generates exactly the same result.
Here is the example and the calculated columns.
Example:
| Index | Name | whatever |
| 1 | a | 1 |
| 2 | b | 1 |
| 3 | c | 1 |
| 4 | d | 1 |
| 5 | b | 2 |
| 6 | a | 2 |
| 7 | b | 3 |
| 8 | b | 4 |
| 9 | e | 1 |
| 10 | f | 1 |
| 11 | e | 2 |
| 12 | b | 5 |
| 13 | c | 2 |
| 14 | a | 3 |
Calculated column 1:
with eariler countrow =
COUNTROWS(
FILTER(example,
example[index] <= EARLIER(example[index])
&& example[name] = EARLIER(example[name])))
Calculated column 2:
wihout earlier countrow =
var i = example[index]
var n = example[name]
return
COUNTROWS(
FILTER(example,
example[index] <= i
&& example[name] = n))
Result:
Both calculated column 1 and calculated column 2 give the same result. I am wondering if they are equivalent expressions or just coincidently happen to be the same. If they are equivalent, that means the EARLIER function can actually be replaced by setting it as VAR?
Solved! Go to Solution.
@Anonymous , Both calculations end up doing the same thing. And we can use these approaches interchangeably
Have read lots of articles. I found out that they are just the same.
Yes, understand that they end up doing the same thing. But devils in the details, since I have no idea what principle or mechanism behind them, so I am worrying about if there are any occasions that make two different results by two different expressions (given that they are fundamentally not identical).
So are they actually equal to each other, simply just different expressions?
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!