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
pwe5000
Frequent Visitor

EARLIER function does not recognize my column names

Hello! I've looked for an answer to this all over the place, and I can't find anyone directly addressing it.

 

In the Microsoft DAX documentation, it gives this example for the EARLIER function:

 

ProductSubcategoryKeyEnglishProductSubcategoryName TotalSubcategorySales SubcategoryRanking
18Bib-Shorts$156,167.8818
26Bike Racks$220,720.7014
27Bike Stands$35,628.6930
28Bottles and Cages$59,342.4324
5Bottom Brackets$48,643.4727

 

= COUNTROWS(FILTER(ProductSubcategory, EARLIER(ProductSubcategory[TotalSubcategorySales])<ProductSubcategory[TotalSubcategorySales]))+1

 

In trying to apply this to my use case, I get an error telling me that my column name isn't recognized:

pwe5000_0-1643823679037.png

 

The SalesOrder column is not a calculated column or a measure, but a column imported from my data source.

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @pwe5000 ,

EARLIER will return the current value in a calculated column, not a measure. In a measure, MAX/MIN/SUM can return the current value.

According to your description, I create a sample. I create a calculated column by your formula, it calculates the number of SalesOrders that are the same as the current SalesOrder.

vkalyjmsft_0-1644384088311.png

If you want to filter out all duplicates, here's my solution.

1.Add a index column in Power Query.

vkalyjmsft_1-1644384570748.png

2.Create a calculated column.

Rank = 
RANKX (
    FILTER (
        'Hobart Sales on Ebay',
        'Hobart Sales on Ebay'[SalesOrder]
            = EARLIER ( 'Hobart Sales on Ebay'[SalesOrder] )
    ),
    'Hobart Sales on Ebay'[Index],
    ,
    ASC,
    DENSE
)

Get this table.

vkalyjmsft_3-1644384926521.png

 

3.By selecting Rank is 1, it will filter out all duplicates.

vkalyjmsft_2-1644384876201.png

vkalyjmsft_4-1644384969480.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @pwe5000 ,

EARLIER will return the current value in a calculated column, not a measure. In a measure, MAX/MIN/SUM can return the current value.

According to your description, I create a sample. I create a calculated column by your formula, it calculates the number of SalesOrders that are the same as the current SalesOrder.

vkalyjmsft_0-1644384088311.png

If you want to filter out all duplicates, here's my solution.

1.Add a index column in Power Query.

vkalyjmsft_1-1644384570748.png

2.Create a calculated column.

Rank = 
RANKX (
    FILTER (
        'Hobart Sales on Ebay',
        'Hobart Sales on Ebay'[SalesOrder]
            = EARLIER ( 'Hobart Sales on Ebay'[SalesOrder] )
    ),
    'Hobart Sales on Ebay'[Index],
    ,
    ASC,
    DENSE
)

Get this table.

vkalyjmsft_3-1644384926521.png

 

3.By selecting Rank is 1, it will filter out all duplicates.

vkalyjmsft_2-1644384876201.png

vkalyjmsft_4-1644384969480.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

parry2k
Super User
Super User

@pwe5000 what you are trying to achieve? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi parry2k,

 

Good point! It's also possible that there's a more effective way to do this: I want this measure to identify duplicates in the SalesOrder column. I don't want to remove the duplicates completely, but I do want to be able to use this new column to filter out all duplicates in the SalesOrder column (i.e. not keeping one copy of each duplicate).

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