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
agudis
Regular Visitor

Filter a column by the current row value of that column

I have a column of dates (not continuous)

 

File Date
4/10/2023
4/3/2023
4/6/2023
4/1/2023
4/25/2023
3/21/2023

 

I want to make a calculated column that returns the latest date in the column that is before than the current file date.

File DatePrevious Date
4/10/20234/6/2023
4/3/20234/1/2023
4/6/20234/3/2023
4/1/20233/21/2023
4/25/20234/10/2023
3/21/2023BLANK

 

However I can't figure out how to filter a column by value in it's own row without creating a circular dependency. In my code below, is there a way to make 'Table1'[File Date] refer to the [File Date] column on the left, and the current row value on the right?

Previous Date = CALCULATE(
        MAX('Table1'[File Date]),
        'Table1'[File Date] < 'Table1'[File Date]
    )
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @agudis 

try like:

Previous Date =
VAR CurrentDate = Table1[Date]
RETURN
MAXX(
    FILTER(
        Table1,
        Table1[Date]<CurrentDate
    ),
    Table1[Date]
)

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @agudis 

try like:

Previous Date =
VAR CurrentDate = Table1[Date]
RETURN
MAXX(
    FILTER(
        Table1,
        Table1[Date]<CurrentDate
    ),
    Table1[Date]
)

Works great, thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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