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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Annemie19
Helper II
Helper II

Select first date in table after certain date

Hi there, 

 

I have a date specified by the user (AA Last Value Date), I need to write a measure to select the first projection date (ProjEndDate_Date) in another table after the value date. For instance, if my value date is 31/08/2020, and my Projection date column is as follows:

 

Annemie19_0-1598621065504.png

 

it needs to return 30 Sept 2020.

1 ACCEPTED SOLUTION

@Annemie19  Try this:

AA Last Proj_date =
VAR LastValueDate =
    SELECTEDVALUE ( CashProjection[AA Last value date] )
VAR DatesGreaterThanValueDate =
    FILTER (
        SUMMARIZE (
            CashProjection,
            CashProjection[ProjEndDate_Date],
            CashProjection[AA Last value date]
        ),
        CashProjection[ProjEndDate_Date] > LastValueDate
    )
VAR NextImmediateDate =
    MINX ( DatesGreaterThanValueDate, CashProjection[ProjEndDate_Date] )
RETURN
    NextImmediateDate

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Annemie19 , In table 2, you can have a new column

 

minx(filter(table1, table1[user] =table2[user]), table1[projenddate_date])

minx(filter(table1, table1[user] ="AA"), table1[projenddate_date])

minx(table1, table1[projenddate_date])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AntrikshSharma
Super User
Super User

@Annemie19 I am just guessing this would work fo you based on the limited information. You will have to modify the table names accordingly.

 

=
VAR LastValueDate =
    DATE ( 2020, 08, 31 ) -- If you want to remove the static date then use SELECTEDVALUES ( Table[Column] ) 
VAR DatesGreaterThanValueDate =
    FILTER (
        ALL ( Table ),
        Table[ProjectEndDates] > LastValueDate
    )
VAR NextImmediateDate =
    MINX ( DatesGreaterThanValueDate, Table[ProjectEndDates] )
RETURN
    NextImmediateDate

 

Hi Antriksh, 

 

Thanks a lot for your help. 

 

For the screenshot below it is giving the correct date (AA Last Proj_date) which is 30 Sept 2020.

 

112.JPG

 

But, for the next screenshot, it is giving 30 Sept as well. Even though it should be 20 Nov 2020. 

 

111.JPG

 

The DAX is used is as follows:

AA Last Proj_date =
VAR LastValueDate = [AA Last value date]
VAR DatesGreaterThanValueDate =
FILTER (
ALL (CashProjection), CashProjection[ProjEndDate_Date] > LastValueDate)
VAR NextImmediateDate =
MINX (DatesGreaterThanValueDate,CashProjection[ProjEndDate_Date])
RETURN NextImmediateDate
 
Can you maybe help me with why it is not giving the correct dates for different DealID's?
 
Kind Regards, 
Annemie

@Annemie19  Try this:

AA Last Proj_date =
VAR LastValueDate =
    SELECTEDVALUE ( CashProjection[AA Last value date] )
VAR DatesGreaterThanValueDate =
    FILTER (
        SUMMARIZE (
            CashProjection,
            CashProjection[ProjEndDate_Date],
            CashProjection[AA Last value date]
        ),
        CashProjection[ProjEndDate_Date] > LastValueDate
    )
VAR NextImmediateDate =
    MINX ( DatesGreaterThanValueDate, CashProjection[ProjEndDate_Date] )
RETURN
    NextImmediateDate

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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