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
Anonymous
Not applicable

Earliest Time of each hour

Hi Team,

Need help in achieving the below results.

The source data has value based on timestamp and need to find the min value of hour of time from the dataset.

Source:

Source:
TIME	VALUE
11/19/2020 15:31	167.79
11/19/2020 15:31	168.01
11/19/2020 15:21	167.7
11/19/2020 15:11	167.7
11/19/2020 15:11	167.7
11/19/2020 15:01	167.92
11/19/2020 15:01	167.7
11/19/2020 14:51	167.92
11/19/2020 14:51	167.7
11/19/2020 14:41	167.92
11/19/2020 14:41	167.7
11/19/2020 14:31	167.91
11/19/2020 14:31	167.7
11/19/2020 14:21	167.91
11/19/2020 14:20	167.7
11/19/2020 14:10	167.7
11/19/2020 14:01	167.79
11/19/2020 14:00	168.01
11/19/2020 13:50	168.01
11/19/2020 13:40	167.91
11/19/2020 13:40	167.7
11/19/2020 13:30	167.7
11/19/2020 13:30	167.7
11/19/2020 13:20	168.01
11/19/2020 13:20	168.01
11/19/2020 13:10	168.01
11/19/2020 13:00	168.01


Output:
11/19/2020 15:00	167.7
11/19/2020 14:00	168.01
11/19/2020 13:00	168.01

 

Thanks ,

Raj

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

Hi @Anonymous ,

 

Based on your description, you can do some steps as follows.

  1. Create a column to group by hour.

 

_hour = HOUR([TIME])

2. Create a measure.

 

calculated_value =

var x1=CALCULATE(MIN('Case2_2'[TIME]),ALLEXCEPT(Case2_2,Case2_2[_hour]))

return

CALCULATE(MIN('Case2_2'[VALUE]),FILTER(ALL('Case2_2'),'Case2_2'[TIME]=x1))

 

3. Create a table visual.

v-yuaj-msft_0-1606092055707.png

 

v-yuaj-msft_1-1606092055710.png

 

Result:

v-yuaj-msft_2-1606092055713.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

4 REPLIES 4
v-yuaj-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, you can do some steps as follows.

  1. Create a column to group by hour.

 

_hour = HOUR([TIME])

2. Create a measure.

 

calculated_value =

var x1=CALCULATE(MIN('Case2_2'[TIME]),ALLEXCEPT(Case2_2,Case2_2[_hour]))

return

CALCULATE(MIN('Case2_2'[VALUE]),FILTER(ALL('Case2_2'),'Case2_2'[TIME]=x1))

 

3. Create a table visual.

v-yuaj-msft_0-1606092055707.png

 

v-yuaj-msft_1-1606092055710.png

 

Result:

v-yuaj-msft_2-1606092055713.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

@Anonymous , Create a column like this as suggested in last update

TIME new = [TIME].date + time(hour([TIME],0,0)

 

And then use this in visual with measure given below

firstnonblankvalue(Table[TIME], max(Table[Value]))

Anonymous
Not applicable

As i am using the direct query , the solution above is showing error.

mahoneypat
Employee
Employee

You should be able to get your result as follows

 

- in the query editor, split your datetime column at the space and convert to date and time

- add a column by selecting your time column and in the Time pull down choose Hour

- load the table

- make a table visual with the Date column and the new hour column

- also add the Value column and choose min as the aggregation (or write a measure with MIN() )

 

Note: if you table is already loaded, you could also do the same with DAX columns, but I would do it in query.

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.