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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
JK-1
Helper II
Helper II

mark / tag latest date (would filter be necessary in calculate ?)

Have had some helpful RANKX advice in the past and researched some MAX , LASTDATE situations but still not sure the best way to attempt / resolve something new for the below.  Looking for the return to give a final unique entry marker on the relevant row which is going to be based on the latest date of said Store Number up to a current date [today, or in the example given 31/05/2025] to deal with how future dates shouldn't be selected as latest/ LAST available row in the data.

Grateful for pointers, many thanks

   return marker
StoreTargetTarget DateLatest - && DATE<=(2025,5,31)
152112/01/2025 
186801/01/2025"Last" / 1 / Etc.
231701/02/2023 
232802/07/2024"Last" / 1 / Etc.
71802/02/2024"Last" / 1 / Etc.
48106/06/2025 [               ]  single entry, but nothing as future date
73311/10/2025 
154419/02/2025 
15903/03/2025"Last" / 1 / Etc.
151405/08/2025 
1 ACCEPTED SOLUTION
Ashish_Excel
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(MAX(Data[Target Date]),FILTER(Data,Data[Store]=EARLIER(Data[Store])&&Data[Target Date]<today()))=Data[Target Date],"Last",BLANK())

Hope this helps.

Ashish_Excel_0-1747882744456.png

 

View solution in original post

5 REPLIES 5
Ashish_Excel
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(MAX(Data[Target Date]),FILTER(Data,Data[Store]=EARLIER(Data[Store])&&Data[Target Date]<today()))=Data[Target Date],"Last",BLANK())

Hope this helps.

Ashish_Excel_0-1747882744456.png

 

Thanks again for this @Ashish_Excel  

 

A further column has been introduced [Completed Date].  How could I adapt the condition to firstly look that Completion Date isn't blank, before performing the remainder? Am slightly stumped there

 

And a separate follow-on if I wanted to uncap the TODAY Target date including only less than, what would be the best way to drop that out of the condition? I've tried a few things but haven't cracked that either yet.

 

=if(CALCULATE(MAX(Data[Target Date]),FILTER(Data,Data[Store]=EARLIER(Data[Store])&&Data[Target Date]<today()))=Data[Target Date],"Last",BLANK())

 

Thanks

Thanks - amazing!

You are welcome.

Arash_Bhz
Frequent Visitor

I am not sure what the level of granularity is, assuming store number and your datatable is called 'stores', create a calculated column to mark each row so you can filter the Future one out by slicer to exclude future dates, Here is the formula for the column:
Marker = 
VAR CurrentDate = 'StoreTargets'[Target Date]
VAR StoreID = 'StoreTargets'[Store]
VAR LatestValidDate =
CALCULATE (
MAX('StoreTargets'[Target Date]),
FILTER (
'StoreTargets',
'StoreTargets'[Store] = EARLIER('StoreTargets'[Store]) &&
'StoreTargets'[Target Date] <= TODAY()
)
)
RETURN
IF (
CurrentDate <= TODAY(),
IF (CurrentDate = LatestValidDate, "Last Valid Date", "Valid"),
"Future, Non Valid "
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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