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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
thmonte
Helper IV
Helper IV

Show all records that touch a date range

I am trying to create a measure to use in my visuals that will filter all dates that cross a range.

 

So I have one table that has start date & end date columns.  I also have a Date Table with unique dates in a range with a relationship.  I pull in my Unique Date Slicer and I write a measure against the Data Table that looks similar to this.

 

FILTER (
'DataTable',
( 'DataTable.StartDate <= dateSlicer.minDate
&& DataTable.EndDate >= dateSlicer.maxDate )
)

 

And then put visual level filter with that measure thats greater than 0

 

This works but in my table I don't get the results I want unless i filter down to a single day.

 

so if I have a record with a start Date and end Date of 8/11 a single day it will not show up in my main table until I filter down to that one day.

 

Here is a Sample PBIX file - https://drive.google.com/open?id=1mBnO6FtAQ00iRmaFKbImLEV_DR_u72WW

 

 

8-21-2018 12-59-10 PM.jpg

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

the problem that you have to tackle is called "events in progress", here you will find some readings that also provide solutions.

 

and a whitepaper that describes the problem in much detail

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@thmonte

 

your filter function is wrong. you were looking at < min date and more than max date. you needed to look at between the 2 dates

 

Count Rows =
VAR maxDate =
MAX ( 'Date'[Date] )
VAR minDate =
MIN ('Date'[Date])
RETURN
CALCULATE (
COUNTROWS ( Records ),
FILTER (
Records,
( Records[Start Date].[Date] >= minDate
&& Records[Fake End Date].[Date] <= maxDate )
)
)

TomMartens
Super User
Super User

Hey,

 

the problem that you have to tackle is called "events in progress", here you will find some readings that also provide solutions.

 

and a whitepaper that describes the problem in much detail

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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