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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
carolynhn25
Frequent Visitor

Date Filters/Functions in DAX

Hello!

 

I am trying to use two date columns from the same table to filter a page in my report but am having difficulty getting the end results that I want. There are two components to what I'm trying to do.

 

1. I need to filter the data in the table to only return results inbetween the dates in two columns

 

2. I want the report page to default to today's date, with the option of changing the date with a slicer

 

So the end result I'm aiming for is for the data to be filtered to only include rows with a date inbetween the two columns, and then the report page auto-filtered for TODAY with the option of adjusting the dates via slicer. 

 

Thank you in advance for any help you're able to provide!!

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1667189289361.png

 

 

Jihwan_Kim_0-1667189245682.png

 

 

Value measure: =
CALCULATE (
    SUM ( Data[Value] ),
    FILTER (
        Data,
        Data[DateStart] <= MAX ( 'Calendar'[Date] )
            && Data[DateEnd] >= MIN ( 'Calendar'[Date] )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors