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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AdamRobC
Helper II
Helper II

Using EARLIER function to return an earlier non-zero value based on column criteria

Hi, I am trying to write some DAX that looks for an earlier non-zero value of a column based on multiple column criteria.

e.g. for row 3 below it would return the most 'recent' non-zero value where both SKU and Country match i.e. 15.40

 

I've had some joy using the below but it's not really working as I want it to:

Test = CALCULATE(MAX('Price Lookup'[Current Price (€)]),FILTER('Price Lookup','Price Lookup'[Config-SKU]=EARLIER('Price Lookup'[Config-SKU]) && 'Price Lookup'[Country]=EARLIER('Price Lookup'[Country])))
 

AdamRobC_1-1625197035619.png

AdamRobC_0-1625196954581.png

Thanks!

1 REPLY 1
amitchandak
Super User
Super User

@AdamRobC , this one seems correct. check do you have any other row, which is causing that or you need any additional filter

 

you can try this too


Test = MAXX(FILTER('Price Lookup','Price Lookup'[Config-SKU]=EARLIER('Price Lookup'[Config-SKU]) && 'Price Lookup'[Country]=EARLIER('Price Lookup'[Country])),'Price Lookup'[Current Price (€)])

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.