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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

filter time range value

Hello ,I want to filter data from 9pm to 9 am how to get this ,sharing my data table with you

time range.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Flag =

var _len=LEN(MAX('Table'[Interval]))
var _left=
VALUE(
IF(
    _len=10,LEFT(MAX('Table'[Interval]),1),LEFT(MAX('Table'[Interval]),2)))
var _right=
RIGHT(
    MAX('Table'[Interval]),2)
var _flag=
IF(
    _right="AM"&&_left=12,0,
    IF(
_right="PM"&&_left<12,_left+12,_left))
return
IF(
    _flag>=9&&_flag<=9+12,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1673244284727.png

 

3. Result:

vyangliumsft_1-1673244284730.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Flag =

var _len=LEN(MAX('Table'[Interval]))
var _left=
VALUE(
IF(
    _len=10,LEFT(MAX('Table'[Interval]),1),LEFT(MAX('Table'[Interval]),2)))
var _right=
RIGHT(
    MAX('Table'[Interval]),2)
var _flag=
IF(
    _right="AM"&&_left=12,0,
    IF(
_right="PM"&&_left<12,_left+12,_left))
return
IF(
    _flag>=9&&_flag<=9+12,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1673244284727.png

 

3. Result:

vyangliumsft_1-1673244284730.png

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Hello ,
sharing my dymmy data and expected results with you  please check 

https://docs.google.com/spreadsheets/d/1xxoD5dwukSIq_tKpbqpxW-uh0xyANbr7/edit?usp=sharing&ouid=10564...

Mahesh0016
Super User
Super User

@Anonymous  Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.