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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vincenardo
Helper I
Helper I

Find Earliest Date on Filtered Set of Values in Table

I need to find the earliest date in my data, for Each Job No and PhaseID but exclude from my result any dates that are 12/30/1899.

 Here is a sample of my data -

 

2022-05-22_6-00-49.png

 

I have tried various solutions, but none seam to provide the result. I was able to get the result be creating a new column called 'SchedStartDateFiltered' which uses a conditional statement to return the ScheduledStartDate or blank if = 1899 and then use a measure formula, but I need to create this as a column with a DAX statement so I can use it in my matrix table.

 

Help is appreciated!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@vincenardo 

you can also try this

Column = MINX(FILTER('Table','Table'[schedulestartdate]<>date(1899,12,30) && 'Table'[jobno]=EARLIER('Table'[jobno])&&'Table'[phaseid]=EARLIER('Table'[phaseid])),'Table'[schedulestartdate])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@vincenardo 

you can also try this

Column = MINX(FILTER('Table','Table'[schedulestartdate]<>date(1899,12,30) && 'Table'[jobno]=EARLIER('Table'[jobno])&&'Table'[phaseid]=EARLIER('Table'[phaseid])),'Table'[schedulestartdate])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




If I want to do the same but only filter on Job No and not inclde Phase ID, can you provide me the adjustment? The solution you provided works perfectly, I just want the option. Thanks!

@vincenardo 

you can try this

 

Column = MINX(FILTER('Table','Table'[schedulestartdate]<>date(1899,12,30) && 'Table'[jobno]=EARLIER('Table'[jobno])),'Table'[schedulestartdate])

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




hnguy71
Memorable Member
Memorable Member

Hi @vincenardo ,

 

Please try this as a measure:

MinDate = CALCULATE(MIN(YOUR_TABLE[ScheduleStartDate]), ALLEXCEPT(YOUR_TABLE,YOUR_TABLE[Job No]),YOUR_TABLE[ScheduleStartDate] <> DATE(1899, 12, 30))

 

Alternatively, you can do the same in a calculated column:

MinDate = CALCULATE(MIN(YOUR_TABLE[ScheduleStartDate]), FILTER(YOUR_TABLE, YOUR_TABLE[Job No] = EARLIER(YOUR_TABLE[Job No]) && YOUR_TABLE[ScheduleStartDate] <> DATE(1899, 12, 30)))

 

Let me know if that works out for you. 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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