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

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

Reply
cottrera
Post Prodigy
Post Prodigy

DAX - Max time

Hi

 

I have a table containing the following columns. Date, Name and Time. See example table below. You will see that some names have multiple times on the same date.

I need to create a new column on this table that uses DAX to find the MAX Time for each person by date

 

DateTimeNameMax Time - Expected result
06/04/202111:08:37Anthony 
06/04/202115:40:02Anthony 
06/04/202117:19:52Anthony17:19:52
07/04/202117:17:54Anthony17:17:54
08/04/202110:21:58Anthony10:21:58
21/04/202120:30:00Bradley20:30:00
22/04/202118:30:00Bradley 
22/04/202118:35:00Bradley18:35:00
26/04/202120:00:00Bradley 
28/04/202120:00:00Bradley 
28/04/202122:00:00Bradley 
28/04/202123:59:59Bradley23:59:59
29/04/202121:00:00Bradley21:00:00
06/04/202110:09:51Ludo 
06/04/202112:05:19Ludo 
06/04/202113:03:15Ludo 
06/04/202113:46:57Ludo 
06/04/202116:17:16Ludo16:17:16

 

thank you

Richard

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @cottrera 

Please check the below.

It is for creating a new column.

 

Picture1.png

 

Max Time CC =
VAR currentdate = 'Table'[Date]
VAR currentanme = 'Table'[Name]
RETURN
IF (
CALCULATE (
MAX ( 'Table'[Time] ),
FILTER ( 'Table', 'Table'[Date] = currentdate && 'Table'[Name] = currentanme )
) = 'Table'[Time],
'Table'[Time],
BLANK ()
)
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @cottrera 

Please check the below.

It is for creating a new column.

 

Picture1.png

 

Max Time CC =
VAR currentdate = 'Table'[Date]
VAR currentanme = 'Table'[Name]
RETURN
IF (
CALCULATE (
MAX ( 'Table'[Time] ),
FILTER ( 'Table', 'Table'[Date] = currentdate && 'Table'[Name] = currentanme )
) = 'Table'[Time],
'Table'[Time],
BLANK ()
)
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you again for your quick response. The DAX function did not work at first. This was due to the table being a direct query. When I converted it to import the dax worked fine. 😀

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.