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

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

Reply
Anonymous
Not applicable

Filter a table by date using DAX

Hello,

How can I filter a table for a date field using DAX? I have a date range to filter.

The output would be a second table.

Thank you!
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Give this a try, you will just need to change the table and column names to match your data.

Filtered Sales = 
CALCULATETABLE(
    Sales,
    DATESBETWEEN ( Sales[Sales Date], DATE(2019,1,15), DATE(2019,2,5) )
)

This creates a new table called 'Filtered Sales' that is the Sales table filtered to 1/15/2019 - 2/5/2019

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

How can I create a measure to get the values for one specific date, 

 

I created a variable for the date, but the calculate(measure, filter(date=variable date)) returns a blank result

v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can set date range directly.

Table =
VAR DateStart =
    DATE ( "2018", "1", "5" )
VAR DateEnd =
    DATE ( "2018", "1", "15" )
RETURN
    CALCULATETABLE (
        TEST,
        FILTER ( TEST, TEST[Date] <= DateEnd && TEST[Date] >= DateStart )
    )

Or you can set a  start time and time interval to define your date range.

 

Table 2 =
VAR DateStart =
    DATE ( "2018", "1", "1" )
RETURN
    CALCULATETABLE ( TEST, DATESINPERIOD ( TEST[Date], DateStart, 15, DAY ) )

You can define the time interval by day, month, season, year. Here is the documentation for DATESINPERIOD() function.

https://docs.microsoft.com/en-us/dax/datesinperiod-function-dax

 

These two DAX queries return a same table. You can choose one of them.DAX.PNG

 

Here is my test file, you can click the following link and download it.

https://wicren-my.sharepoint.com/:u:/g/personal/michael_wicren_onmicrosoft_com/ETVz0nkTJ3NMhRKnZJ6dRKkBeR8uUTIP0NtJdTnYyXqz0g?e=b28dSt

 

Best Regards,

Eads

 

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

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Give this a try, you will just need to change the table and column names to match your data.

Filtered Sales = 
CALCULATETABLE(
    Sales,
    DATESBETWEEN ( Sales[Sales Date], DATE(2019,1,15), DATE(2019,2,5) )
)

This creates a new table called 'Filtered Sales' that is the Sales table filtered to 1/15/2019 - 2/5/2019

Hello, is there any option using the filter parameter used in the report?  Because i'm trying but the selected date not filter 

Anonymous
Not applicable

Thank you so much! Your method worked for me

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.