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
Anonymous
Not applicable

How to Apply Date Filter to only One Category of Data Records

Hello,

 

I have a data set that consists of records that are categorized as either "Active" or "Complete" in a Status field. I would like a date filter on my PowerBI page to only apply to any records that are listed as "Complete", but I would also like to always include all records that are "Active" in the page as well.

 

For example: If the the date filter is set to (ProjectDate >= 1/5/2023 and Project Date <= 1/24/2023), I would like "Complete" records with a project date that qualifies within the ProjectDate filter range included in the page in addition to all "Active" records regardless of whether the "Active" record's ProjectDate falls within the ProjectDate range or not.

 

Is this functionality possible within PowerBI?

 

Thank you,

Paul

 

Sample data below:

StatusProjectDateValue
Active1/5/20231.176091
Complete1/6/20231.20412
Active1/7/20231.230449
Complete1/8/20231.176091
Active1/9/20231.20412
Complete1/10/20231.230449
Active1/11/20231.176091
Complete1/12/20231.20412
Active1/13/20231.230449
Complete1/14/20231.176091
Active1/15/20231.20412
Complete1/16/20231.230449
Active1/17/20231.176091
Complete1/18/20231.20412
Active1/19/20231.230449
Complete1/20/20231.176091
Active1/21/20231.20412
Complete1/22/20231.230449
Active1/23/20231.176091
Complete1/24/20231.20412
Active1/25/20231
Complete1/26/20232
Active1/27/20233
Complete1/28/20234
Active1/29/20235
Complete1/30/20236
Active1/31/20237
Complete2/1/20238
Active2/2/20239
Complete2/3/202310
Active2/4/202311
Complete2/5/202312
Active2/6/202313
Complete2/7/202314
Active2/8/202315
Complete2/9/202316
Active2/10/202317
Complete2/11/202318
Active2/12/202319
Complete2/13/202320
Active2/14/202321
Complete2/15/202322
Active2/16/202323
Complete2/17/202324
Active2/18/202325
Complete2/19/202326
Active2/20/202327
Complete2/21/202328
Active2/22/202329
Complete2/23/202330
Active2/24/202331
Complete2/25/202332
Active2/26/202333
Complete2/27/202334
Active2/28/202335
1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You cannot set a specific date filter for a status alone in the Filters. However, you can create a separate calendar table for slicer filtering.

Here's my solution.

1.Create a seperate calendar table and it's for the date slicer.

Calendar = CALENDAR(MIN('Table'[ProjectDate]),MAX('Table'[ProjectDate]))

vstephenmsft_0-1681718355955.png

 

2.Create a measure for visual-level filters. Put it into the visual-level filters and set up show items when the value is 1.

Measure = var _start=MIN('Calendar'[Date])
var _end=MAX('Calendar'[Date])
var _date=MAX('Table'[ProjectDate])
return IF(MAX('Table'[Status])="Active",IF(_date>=_start&&_date<=_end,1),1)

vstephenmsft_1-1681718537634.png

 

3.Here's the result. Only "Active" dates are filtered, other statuses are not.

vstephenmsft_2-1681718592467.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You cannot set a specific date filter for a status alone in the Filters. However, you can create a separate calendar table for slicer filtering.

Here's my solution.

1.Create a seperate calendar table and it's for the date slicer.

Calendar = CALENDAR(MIN('Table'[ProjectDate]),MAX('Table'[ProjectDate]))

vstephenmsft_0-1681718355955.png

 

2.Create a measure for visual-level filters. Put it into the visual-level filters and set up show items when the value is 1.

Measure = var _start=MIN('Calendar'[Date])
var _end=MAX('Calendar'[Date])
var _date=MAX('Table'[ProjectDate])
return IF(MAX('Table'[Status])="Active",IF(_date>=_start&&_date<=_end,1),1)

vstephenmsft_1-1681718537634.png

 

3.Here's the result. Only "Active" dates are filtered, other statuses are not.

vstephenmsft_2-1681718592467.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

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.