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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
df123445
Helper II
Helper II

Issue with start/end date filtering

I have a table with a created and expired date fields, I want to have 2 filters where the user can select the date range 

 

df123445_2-1729691286884.png

 

the relationships are:

Date_start.date -> expired

Date_end.date -> created 

 

when I move the "after" date_start filter, any record that is expired before the selected date should disappear 

when I move the "before" end_date filter, any record that was created after the selected date should disappear

 

df123445_1-1729691234028.png

 

The issue is that the "after" date start filter works perfectly, but the other one does nothing! I also tried to remove the start filter or to make the start date relationships inactive, but nothing seems to change. 

I can't understand how can a simple filter not filter anything! 

 

Anyone has faces a similar issue ? TIA 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @df123445 

Thanks for Ashish_Mathur and audreygerred reply. Using the same data structure as you, it seems to work fine.

vyaningymsft_1-1729749898592.png

vyaningymsft_0-1729749879940.png

You can refer to their suggestions, or refer to the following dax.

vyaningymsft_2-1729750187500.pngvyaningymsft_3-1729750274618.png

 

 

Filter = 
VAR _startDate = MIN('Date Start 2'[DateStart])
VAR _endDate = MAX('Date End 2'[Date End])
VAR _created = SELECTEDVALUE('Distinct'[Created])
VAR _expired = SELECTEDVALUE('Distinct'[Expired])
VAR _result = IF(_created>=_startDate && _expired<=_endDate,1,0)
RETURN
_result

 

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, @df123445 

Thanks for Ashish_Mathur and audreygerred reply. Using the same data structure as you, it seems to work fine.

vyaningymsft_1-1729749898592.png

vyaningymsft_0-1729749879940.png

You can refer to their suggestions, or refer to the following dax.

vyaningymsft_2-1729750187500.pngvyaningymsft_3-1729750274618.png

 

 

Filter = 
VAR _startDate = MIN('Date Start 2'[DateStart])
VAR _endDate = MAX('Date End 2'[Date End])
VAR _created = SELECTEDVALUE('Distinct'[Created])
VAR _expired = SELECTEDVALUE('Distinct'[Expired])
VAR _result = IF(_created>=_startDate && _expired<=_endDate,1,0)
RETURN
_result

 

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi, the DAX filter is great, but I'm not sure the logic is correct (probably my explanation is lacking).

 

Any record that is active during the timeframe should be shown, even if the expiration is after the "end date".

 

I think it should be:   

 

Filter = 
VAR _startDate = MIN('Date Start 2'[DateStart])
VAR _endDate = MAX('Date End 2'[Date End])
VAR _created = SELECTEDVALUE('Distinct'[Created])
VAR _expired = SELECTEDVALUE('Distinct'[Expired])
VAR _result = IF(_created<=_endDate && _expired>=_startDate,1,0)
RETURN
_result

does it make sense? 

 

I changed the result logic

 

 

 

Anonymous
Not applicable

Hi, @df123445 

Is your DAX formula returning the data you need? One quibble, if the activity is active, then the expiration date should be after the DateEnd, otherwise the DateEnd filter is meaningless.

vyaningymsft_0-1730339715577.png

Best Regards,
Yang

Community Support Team

Ashish_Mathur
Super User
Super User

Hi,

Why create 2 date slicers?  Why not a single date slicer with the between functionality.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

because I have 2 fields, created and expired, can I connect one between slicer to both fields somehow? thanks 

audreygerred
Super User
Super User

Hi! This video is the one I follow when I am trying to accomplish things like you are: DAX measure with start AND end date for Power BI - YouTube





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.