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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors