Forum Discussion

Anonymous_226's avatar
Anonymous_226
Frequent Visitor
2 years ago
Solved

DAX - Getting Earliest Date Time

Hi,

 

I am currently looking at a table of data like the below:

 

Number   Value       Date/Time

001                          12/13/2023 8:29:05 AM

001          Group 1   12/13/2023 8:30:06 AM

001          Group 2   12/14/2023 12:36:42 PM

001          Group 3   12/18/2023  5:04:36 AM

001          Group 4   12/18/2024  4:51:38 AM

001          Group 1    1/1/2024  3:50:26 AM

001          Group 2    1/1/2024  6:50:26 AM

 

I have these columns in a table visual along with a measure and in the measure I am trying to return the earliest start time for "group 1". I also have a slicer that i use to get the dates in my variables from(this slicer is in an unrelated table from the table my data is in.

 

So far this is my DAX:

Measure 1 =

VAR SelectedMonthStartDate = MINX(SomeTable, SomeTable[Created])
VAR Sundayfollowingthe1st = IF(FirstDayOfMonth + MOD(8 - WEEKDAY(FirstDayOfMonth), 7) = SelectedMonthStartDate, (FirstDayOfMonth + MOD(8 - WEEKDAY(FirstDayOfMonth), 7) + 7), (FirstDayOfMonth + MOD(8 - WEEKDAY(FirstDayOfMonth), 7))+1)


VAR AbsoluteEarliestStartPerTicket =
SUMMARIZE(
SomeOtherTable,
SomeOtherTable[Number],
"EarliestStart", MIN(SomeOtherTable[Date/Time])
)

RETURN COUNTROWS(AbsoluteEarliestStartPerTicket)


The issue i am facing is i cant get it to return the earliest start time whihc in the example above would be 12/13/2023 8:30:06 AM


Intsead it is returning 1/1/2024  3:50:26 AM

Any help is greatly appreciated.

6 Replies