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
jd8766
Helper II
Helper II

Get MIN and MAX time per user per day in table?

Hi, I have a table that looks like the below..

I want to show by each day, what the total number of calls was by user, and also the FIRST and LAST time a call was made per user.

jd8766_0-1670499063140.png
My ideal output would be the below..

jd8766_1-1670499164238.png



I have tried the MAX and MIN functions but they return the MAX time in my entire time dimension.. which isn't what I wanted. Any ideas how I can achieve the below?



 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @jd8766

 

You can achieve this directly by using MIN and MAX:

 

MINTime = MIN('Table'[Time])
MaxTime = MAX('Table'[Time])

 

 

Then change the Format of the measures:

vjianbolimsft_1-1672820494289.png

Output:

vjianbolimsft_0-1672820407486.png

If your data is more complex, please try:

 

First Time = CALCULATE(MIN('Table'[Time]),FILTER(ALL('Table'),[Date]=MAX('Table'[Date])&&[User]=MAX('Table'[User])))
Last Time = CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[User]=MAX('Table'[User])&&[Date]=MAX('Table'[Date])))

 

 

Output:

vjianbolimsft_2-1672820601792.png

If you need calculated column:

 

FIRSTTIME = CALCULATE(MIN('Table'[Time]),FILTER('Table',[User]=EARLIER('Table'[User])&&[Date]=EARLIER('Table'[Date])))
LASTTIME = CALCULATE(MAX('Table'[Time]),FILTER('Table',[User]=EARLIER('Table'[User])&&[Date]=EARLIER('Table'[Date])))

 

 

Output:

vjianbolimsft_3-1672820970080.png

If you need a table:

 

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[User],
    'Table'[Date],
    "Total Call",
            SUM ( 'Table'[Calls] ),
    "First Time",
            MIN ( 'Table'[Time] ),
    "Last Time",
            MAX ( 'Table'[Time] )
)

 

 

Output:

 vjianbolimsft_0-1672821233686.png

Best Regards,

Jianbo Li

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

View solution in original post

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @jd8766

 

You can achieve this directly by using MIN and MAX:

 

MINTime = MIN('Table'[Time])
MaxTime = MAX('Table'[Time])

 

 

Then change the Format of the measures:

vjianbolimsft_1-1672820494289.png

Output:

vjianbolimsft_0-1672820407486.png

If your data is more complex, please try:

 

First Time = CALCULATE(MIN('Table'[Time]),FILTER(ALL('Table'),[Date]=MAX('Table'[Date])&&[User]=MAX('Table'[User])))
Last Time = CALCULATE(MAX('Table'[Time]),FILTER(ALL('Table'),[User]=MAX('Table'[User])&&[Date]=MAX('Table'[Date])))

 

 

Output:

vjianbolimsft_2-1672820601792.png

If you need calculated column:

 

FIRSTTIME = CALCULATE(MIN('Table'[Time]),FILTER('Table',[User]=EARLIER('Table'[User])&&[Date]=EARLIER('Table'[Date])))
LASTTIME = CALCULATE(MAX('Table'[Time]),FILTER('Table',[User]=EARLIER('Table'[User])&&[Date]=EARLIER('Table'[Date])))

 

 

Output:

vjianbolimsft_3-1672820970080.png

If you need a table:

 

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[User],
    'Table'[Date],
    "Total Call",
            SUM ( 'Table'[Calls] ),
    "First Time",
            MIN ( 'Table'[Time] ),
    "Last Time",
            MAX ( 'Table'[Time] )
)

 

 

Output:

 vjianbolimsft_0-1672821233686.png

Best Regards,

Jianbo Li

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

amitchandak
Super User
Super User

@jd8766 , If you create min/max measure thtat will work

 

max(Table[time])

 

min(Table[time]) 

 

 

if you need a column

 

minx(filter(Table, [User] = earlier([User]) ),[Time])

Helpful resources

Announcements
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.