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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JSher
Frequent Visitor

Filter a table on 2 time measures +- X hours

Hello, 

I have a page that shows values over time of day for a single day.

 

The user can drill through on the time to another page that I wish to show information on that time +- 1 hour from another table.

 

I have the time value coming through as CTime and am using DAX to create 2 DateTime measures BeginTime and EndTime and they are both correct.  

 

What I cannot figure out is how to filter another table of data using those 2 times: 

Example

Table to filter: TimeActions

                        DateTime ActionDateTime   Varchar Action

                                       20210420 0300                 Action1

                                       20210420 0600                 Action2

                                       20210420 0700                 Action3

                                       20210420 0800                 Action4

                                       20210420 1100                 Action5

If CTime comes through at 20210420 0700 I should see Actions 2,3,4 

Thanks

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @JSher,

 

Try measure as:

Measure 3 = 
CALCULATE(
    MAX(TimeActions[Varchar Action]),
    FILTER(
        ALL(TimeActions),
        TimeActions[DateTime ActionDateTime]>[BeginTime]-1/24 && TimeActions[DateTime ActionDateTime]<[EndTime]+1/24
    )
)

If is does not work, please provide your pbix after removing sensitive information.

 

Best Regards,

Link 

 

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

I tried this every way I could including using a filtered table just with the filter:

FILTER(
        ALL(TimeActions),
        TimeActions[DateTime ActionDateTime]>[BeginTime]-1/24 && TimeActions[DateTime ActionDateTime]<[EndTime]+1/24
    )

but could not get it to work.  

 

Please find attached file to test a filter of +-1 hour on a drill through time.

 

Ive never posted a file on here so attempting a link in google drive:

File 

 

Thanks

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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