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

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

Reply
ukeasyproj
Helper II
Helper II

need help creating a measure that finds the previous event date for a given event

Hi I am currently working in Direct Query mode (unfortunately cannot use import mode for our use case).

 

The goal is to create a column, that finds the last date an event occurred for a given task. (see Previous Date column).

 

test.PNGtest 2.PNG

 

In import mode, I was able to get a solution by creating a calculated column that does:

 

Previous date = CALCULATE(MAX(Sheet1[date of event]),FILTER(Sheet1,Sheet1[date of event]<EARLIER(Sheet1[date of event]) && Sheet1[task id] = EARLIER(Sheet1[task id])))

 

Unfortunately this does not work in Direct Query mode since you cannot use the Calculate function in a calculated column.  So I am wondering if there is a workaround for anyone using Direct Query?

 

 

1 ACCEPTED SOLUTION
ukeasyproj
Helper II
Helper II

I have managed to create a measure:

 

test = CALCULATE(
MAX( Sheet1[date of event] ),
FILTER( ALL(Sheet1) ,
MAXX( FILTER( Sheet1, EARLIER( Sheet1[date of event] ) < Sheet1[date of event] && EARLIER( Sheet1[task id]) = Sheet1[task id]), Sheet1[date of event] )
)
)

 

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Does not work, return last event date not the previous!!!

ukeasyproj
Helper II
Helper II

I have managed to create a measure:

 

test = CALCULATE(
MAX( Sheet1[date of event] ),
FILTER( ALL(Sheet1) ,
MAXX( FILTER( Sheet1, EARLIER( Sheet1[date of event] ) < Sheet1[date of event] && EARLIER( Sheet1[task id]) = Sheet1[task id]), Sheet1[date of event] )
)
)

 

 

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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