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
Learner_SG
Helper IV
Helper IV

Select 4 highest values at different Intervals

Hi , I have a requirement which asks me to select 4 highest time between the time interval of 7AM to 10 PM based on the water usage. 

Currently,it selects the 4 highest between these time ,But, It has to be in such a way that it is evenly distributed. 

So the plan that I have thought is to split the time into intervals of 7AM-11 AM, 12 PM-2 PM - 3-6PM ,7PM-10PM. 

I am not sure how to write it in the DAX. Any help?

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Learner_SG , Create a column like

 

=

Var _time = timevalue([Datime])

return

Switch(True() ,

_time >= Time(7,0,0) && _time < Time(12,0,0) , "7AM-11 AM" ,

_time >= Time(12,0,0) && _time < Time(15,0,0) , "12 PM-2 PM" ,

_time >= Time(15,0,0) && _time < Time(19,0,0) , "3-6PM " ,

_time >= Time(19,0,0) && _time < Time(23,0,0) , "7PM-10PM" )

View solution in original post

2 REPLIES 2
Learner_SG
Helper IV
Helper IV

@amitchandak ,thanks for the help. I am trying to select the highest values using the filter but it selects all the values during that time frame.how to correct it? could help?

Learner_SG_0-1652762992538.png

 

because similarly I need to select all the 4 timeframes and show those times in the table which would be my result. now trying to get for at least 1 time frame correctly.

 

amitchandak
Super User
Super User

@Learner_SG , Create a column like

 

=

Var _time = timevalue([Datime])

return

Switch(True() ,

_time >= Time(7,0,0) && _time < Time(12,0,0) , "7AM-11 AM" ,

_time >= Time(12,0,0) && _time < Time(15,0,0) , "12 PM-2 PM" ,

_time >= Time(15,0,0) && _time < Time(19,0,0) , "3-6PM " ,

_time >= Time(19,0,0) && _time < Time(23,0,0) , "7PM-10PM" )

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.