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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Filtering dates in two date columns

Hi, I can't get my head around filtering of date columns. I have two columns - Report date and Project date. 

When I choose a Report date (say 04.07), I would like to see the latest Project date in another visual (say the latest was on 01.07) but not all the project dates before that (say I have 28.06 and 13.01 dates in the Project column as well) and also exclude any project dates after 04.07.

8 REPLIES 8
mahoneypat
Microsoft Employee
Microsoft Employee

Are the Report Date and Project Date columns in the same table?  In any case, here is an expression you can try

 

Latest Project Date =
VAR __thisreportdate =
    SELECTEDVALUE ( Table[ReportDate] )
RETURN
    CALCULATE (
        MAX ( Table[ProjectDate] ),
        ALL ( Table[ReportDate] ),
        Table[ReportDate] <= __thisreportdate
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat Thanks! The report date column has been copied into the same column. The measure, however, returns always the latest Project date independent of the current Report date... 

hi  @Anonymous 

Could you please share your sample pbix file and your expected output, that will be a great help.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AntrikshSharma
Super User
Super User

Maybe try something like this:

Measure = 
VAR LastVisibleDate =
    MAX ( Sales[Due Date] )
VAR Result =
    CALCULATE (
        MAX ( Sales[Order Date] ),
        FILTER (
            SUMMARIZE ( Sales, Sales[Order Date], Sales[Due Date] ),
            Sales[Order Date] <= LastVisibleDate
        )
    )
RETURN
    Result
Anonymous
Not applicable

Hi @AntrikshSharma I tried it but th measure returns always the latest Project date independent of the current Report date...

Can you share the pbix file, or just the sample data?
Anonymous
Not applicable

Hi @AntrikshSharma

 So the Due Date = Report date and Order Date = Project date or other way around?

What is they are in different tables? How would the line 8 Summarize look like?

Summarize can group by columns of mulitple tables, example:

SUMMARIZE(
    Sales,
    Sales[Order Date],
    Sales[Due Date],
    Customer[Birth Date]
)

summarize.PNG 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.