Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

With or without EARLIER function?

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:

IndexNamewhatever
1a1
2b1
3c1
4d1
5b2
6a2
7b3
8b4
9e1
10f1
11e2
12b5
13c2
14a3

 

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:

hyman9090_1-1668502399808.png

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?

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Both calculations end up doing the same thing. And we can use these approaches interchangeably

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Both calculations end up doing the same thing. And we can use these approaches interchangeably

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Have read lots of articles. I found out that they are just the same.

Anonymous
Not applicable

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?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors