cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## How to get MIN date value for selected ID

Hello, I am trying to follow instructions from this website, but w/o success.

I have personel attendance data splited by lunch break.

I would like to get Time of income (Min value) and time of outcome (max). Unfortunately our HR system works with minus values due to night shift.

Printscreen shows two rows with income -6:00 = 6pm and 00:30 = 00:30am next day.

In MIN collumn I would like to get -6:00, but I am still reaching 00:30.

Unique identificator is in red square (Personal Nr.+Date).

I am using this formula:

Many thanks for any help!
1 ACCEPTED SOLUTION
Community Support

Add a new column use the following expression:

``````DATE/TIME =
IF(
LEN( [Prichod] ) = 9,
TIMEVALUE( RIGHT( [Prichod], 8 ) )
+ DATE( [Year], [Month], [Day] - 1 )
+ TIME( 12, 0, 0 ),
TIMEVALUE( [Prichod] ) + DATE( [Year], [Month], [Day] )
// [Year], [Month], [Day] the same as your table [Rok] [Měsíc] [Den]
)
``````

This column is a date/time type, so that you can compare time with this column. And if you just need the min time you can use the this dax. I did some change with your formula.

``````Min prichod =
VAR A =
CALCULATE(
FILTER(
)
)
RETURN
CALCULATE(
FILTER(
&& [DATE/TIME] = A
)
)
``````

The result :

Best Regards

Community Support Team _ chenwu zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 REPLIES 2
Community Support

Add a new column use the following expression:

``````DATE/TIME =
IF(
LEN( [Prichod] ) = 9,
TIMEVALUE( RIGHT( [Prichod], 8 ) )
+ DATE( [Year], [Month], [Day] - 1 )
+ TIME( 12, 0, 0 ),
TIMEVALUE( [Prichod] ) + DATE( [Year], [Month], [Day] )
// [Year], [Month], [Day] the same as your table [Rok] [Měsíc] [Den]
)
``````

This column is a date/time type, so that you can compare time with this column. And if you just need the min time you can use the this dax. I did some change with your formula.

``````Min prichod =
VAR A =
CALCULATE(
FILTER(
)
)
RETURN
CALCULATE(
FILTER(
&& [DATE/TIME] = A
)
)
``````

The result :

Best Regards

Community Support Team _ chenwu zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Champion

Hi @magicalmagic87 ,

I'd do the following.

Break out the "-" into a new column.

Convert the column into time data format.

Add a new data format conversion to decimal number.

Multiply that column by 24.

Multiply the column by -1 if there is a "-" in the first column.

If the column is negatve this should give you the number of hours you need to subtract from 12 to get the correct time.

Br,
J

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors