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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nick9one1
Helper III
Helper III

filter table between two values with date dimension

I have a backlog table with a start and end date. In my report I am slicing by a financial year and quarter e.g. 2024-2025 Q1. 

I want to return all records in the backlog table where any date between record start and end is in the sliced date dimension.

 

how can I do this?

 

nick9one1_0-1742468196548.png

 

7 REPLIES 7
v-karpurapud
Community Support
Community Support

Hi @nick9one1 

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @nick9one1 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @nick9one1 

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and give a kudos, as this helps other members in  community.

Thank You!

rohit1991
Super User
Super User

Hi @nick9one1 

 

You can filter your table by checking if the date from your fact table lies between the start and end date from your financial year dimension. One way is to create a calculated column like this:

 

IsInSelectedPeriod = 
VAR SelectedStart = SELECTEDVALUE('DateTable'[StartDate])
VAR SelectedEnd = SELECTEDVALUE('DateTable'[EndDate])
RETURN 
IF(
    YourFactTable[Date] >= SelectedStart && YourFactTable[Date] <= SelectedEnd,
    1,
    0
)

 

Then just filter your visuals or table where IsInSelectedPeriod = 1. This should give you the expected results.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
FarhanJeelani
Super User
Super User

HI @nick9one1 ,

Ensure Relationships:

There should not be a direct relationship between Backlog[RecordStart] or Backlog[RecordEnd] and dim_date[Date], as this won't work properly in this case.
Create a DAX Measure for Filtering:

Use a measure to check if any date between RecordStart and RecordEnd exists within the selected financial year and quarter.
DAX

Backlog Filtered =
VAR MinDate = MIN(dim_date[Date]) -- Get min date from slicer
VAR MaxDate = MAX(dim_date[Date]) -- Get max date from slicer

RETURN
IF(
MAX(Backlog[RecordStart]) <= MaxDate &&
MIN(Backlog[RecordEnd]) >= MinDate,
1,
0
)

Apply the Filter in a Visual:

Add this measure as a visual-level filter and set it to 1 to show only relevant records.


Alternative Approach (Calculated Column)
If you want to filter inside a table visual, create a calculated column:

DAX

Within Selected Period =
VAR MinDate = CALCULATE(MIN(dim_date[Date]), ALL(dim_date))
VAR MaxDate = CALCULATE(MAX(dim_date[Date]), ALL(dim_date))

RETURN
IF(
Backlog[RecordStart] <= MaxDate &&
Backlog[RecordEnd] >= MinDate,
"In Period",
"Out of Period"
)


Then, filter the table where Within Selected Period = "In Period".

 

Please mark this post as solution, if it hepls you. Appreciate Kudos.

 

Thanks. This has almost worked. 

In the table below I have added both the measure and the coluclated column.
The measure looks like it works, but the caculated column doesnt. You can see it says 'in period' for a date that doesnt match the slicers above. 
But the measure does seem to work So I will stick with that. 

nick9one1_1-1742805374002.png

 

The only remaining issue is I cannot apply the visual filter to the bar chart. 

I works on the table, but if I try to apply it to the bar chart there are no results;

nick9one1_2-1742805760168.png

 

 

 

 

bhanu_gautam
Super User
Super User

@nick9one1 Add a calculated column to your backlog table to determine if the record falls within the selected financial year and quarter.

DAX
IsInSelectedPeriod =
VAR StartDate = [StartDate]
VAR EndDate = [EndDate]
VAR SelectedStartDate = CALCULATE(MIN('Date'[Date]), ALLSELECTED('Date'))
VAR SelectedEndDate = CALCULATE(MAX('Date'[Date]), ALLSELECTED('Date'))
RETURN
IF (
(StartDate <= SelectedEndDate) && (EndDate >= SelectedStartDate),
1,
0
)

 

Use this calculated column to filter your backlog table in your report. You can add a visual level filter or a page level filter to only show records where IsInSelectedPeriod is 1.

 

If you need to create measures for reporting purposes, you can use a similar logic in your measures. For example:

DAX
BacklogCount =
CALCULATE(
COUNTROWS('BacklogTable'),
FILTER(
'BacklogTable',
'BacklogTable'[IsInSelectedPeriod] = 1
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.