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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply

How to create an hour/minute range filter?

Hi all,

I have a table with several times

jonathangsanto_0-1650416569644.png


GOAL: I need to create a start and end filter by time, filtering this table

What I've done so far:
I created a table that separates the time of a day from 15 to 15 minutes. 00:00 to 23:45

jonathangsanto_2-1650416956014.png

 

 

I want to select the start time and end time, and then it will filter the table within that range. In the example above it would be from 01:00 to 01:15
So the result should be:

jonathangsanto_3-1650417030826.png

I created a filter creating a condition, but I feel like I'm still far away:

var _rangeStart= TIME(00,00,00)
var _rangeEnd= SELECTEDVALUE(RangeTempo[HoraMinuto])

return
if(
SELECTEDVALUE(BH_gold_base[HoraMinuto])>=_rangeStart
&&
SELECTEDVALUE(BH_gold_base[HoraMinuto])<=_rangeEnd,
1)

Can anyone help me?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jonathangsanto , Create two independent table with these time slots and the try a measure like

 

new measure =
var _max = maxx(allselected(Time2),Time2[Time])
var _min = minx(allselected(Time1),Time1[Time])
return
calculate( Count(Table[Time]), filter('Table', 'Table'[Time] >=_min && 'Table'[Time] <=_max))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Can you attach an example?

worked perfectly! Thank you very much

amitchandak
Super User
Super User

@jonathangsanto , Create two independent table with these time slots and the try a measure like

 

new measure =
var _max = maxx(allselected(Time2),Time2[Time])
var _min = minx(allselected(Time1),Time1[Time])
return
calculate( Count(Table[Time]), filter('Table', 'Table'[Time] >=_min && 'Table'[Time] <=_max))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.