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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Need help to filter data in grid based on active date

Hello,

I have an issue with Date ranges in my Power BI report.

I have below requirement.

I want to filter data from my Employment table where I have Employment start date and Employment end date. If I enter date in Date Slicer then It should filter date which is Valid till Employment end date.

I have created Data Table(Dates)

Dates = CALENDAR(date(YEAR(MIN(Employment[employmentstartdate])),1,1),DATE(YEAR(MAX(Employment[employmentenddate])),12,31))

 

In My EmploymentTable, I have created a measure to calculate nos of FTE per employee to filter the data in a grid.

 

NosOfFTE = CALCULATE(MIN(Employment[FTE]), FILTER(Employment, Employment[employmentstartdate] <= SELECTEDVALUE(Dates[Date]) && Employment[employmentenddate] >= SELECTEDVALUE(Dates[Date])))

 

It's not working properly. Can anybody help me?

 

The date on slicer selected: 01/06/2019

Employment start

Employment end

Display record

01/01/2019

31/12/2019

Yes

01/07/2019

31/12/2019

No

01/02/2016

01/07/2019

Yes

01/02/2016

31/05/2019

No

01/02/2014

31/12/2020

Yes

01/07/2019

31/12/2090

No

 

 

Regards,

Parag

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

By my tests based on your data sample, I'm afraid that your logic should be right.

Assuming that I have the table like this and want to calculate the count of ID which is filtered by the slicer.

data sample.PNG

I also create a calendar table with your formula and do not create the relationship for the two tables.

Date = CALENDAR(date(YEAR(MIN(Employment[Employment start])),1,1),DATE(YEAR(MAX(Employment[Employment end])),12,31))

Then I create the measure below.

NosOfFTE = 
CALCULATE (
   COUNT(  'Employment'[ID] ),
    FILTER (
        Employment,
        Employment[Employment start] <= SELECTEDVALUE ( 'Date'[Date])
            && Employment[Employment end] >= SELECTEDVALUE ( 'Date'[Date] )
    )
)

Here is the test output.

Capture.PNG  

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

By my tests based on your data sample, I'm afraid that your logic should be right.

Assuming that I have the table like this and want to calculate the count of ID which is filtered by the slicer.

data sample.PNG

I also create a calendar table with your formula and do not create the relationship for the two tables.

Date = CALENDAR(date(YEAR(MIN(Employment[Employment start])),1,1),DATE(YEAR(MAX(Employment[Employment end])),12,31))

Then I create the measure below.

NosOfFTE = 
CALCULATE (
   COUNT(  'Employment'[ID] ),
    FILTER (
        Employment,
        Employment[Employment start] <= SELECTEDVALUE ( 'Date'[Date])
            && Employment[Employment end] >= SELECTEDVALUE ( 'Date'[Date] )
    )
)

Here is the test output.

Capture.PNG  

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi  ,

 

Thank you for your response. I think the issue is with me about date slicer only. I used date slicer between option. If I use list then it should work. I will check with List and let you know result.

 

Kind regards,

Parag

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors