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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
MWare
Helper I
Helper I

DAX Calculation to retrieve the entry before

Hi,

 

Looking for some help please.

 

I am trying to return the previous 'Sale time' based on the 'Sales Person' of each row in my 'Sales' table.

Unfortunatley the index is based on all sales in the shop and thus I can't use -1 on the index as the Sales Person can vary.

See below image in Power BI, the DAX formula I have created using EARLIER in column 'Prior Sales Time (DAX Help)' is not returning the prior sales time for the sales person for the row.  See the 'Prior Sales Time (the answer I'm after)' column for what the value I'm expecting in my DAX formula.

 

Any ideas? 

 

DAXhelp.JPG

1 ACCEPTED SOLUTION
wdx223_Daniel
Community Champion
Community Champion

=MAXX(FILTER(Sales,Sales[Sale Person]=EARLIER(Sales[Sale Person])&&Sales[Sale Time]<EARLIER(Sales[Sale Time])),Sales[Sale Time])

View solution in original post

2 REPLIES 2
MWare
Helper I
Helper I

Perfect! thank you very much!

 

wdx223_Daniel
Community Champion
Community Champion

=MAXX(FILTER(Sales,Sales[Sale Person]=EARLIER(Sales[Sale Person])&&Sales[Sale Time]<EARLIER(Sales[Sale Time])),Sales[Sale Time])

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.