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
S_Berg
Frequent Visitor

Filter multiple date fields with 1 slicer

I have 4 visuals showing projects in different statuses. I want to show the differet project types in a specified date range by using one slicer the user can adjust. One of the problems I am having is creating a DAX measure that makes it so one slicer can control 3 different date fields, I only want the user to have to put in their date range once.

 

The 4 visuals-

New Projects: Any project where the 'Added Date' field is between the user specified date range.

Active: Any project where the 'Status Date' field is between the user specified date range and the Finished Date field is null.

Pending Projects: Any project where the 'Status Date' field is NOT between the user specified date range and the Finished Date field is null.

Finished Projects: Any project where the 'Finished Date' field is between the user specified date range.

 

I would appreciate any help on how to accomplish this!

 

Thank you!

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @S_Berg ,

 

Sorry, as far as I know, it may not be possible to use only one measure to filter 4 Visual different date fields, which will cause conflicts in the conditions, you can create 4 measures and place them in different Visual settings is=1.

Here are the steps you can follow:

1. Create measure.

New Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Added])>=_mindate&&MAX('Table'[Added])<=_maxdate,1,0)
ACTIVE =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Status])>=_mindate&&MAX('Table'[Added])<=_maxdate&&MAX('Table'[Finished])=BLANK(),1,0)
Pending Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Status])<_mindate|| MAX('Table'[Added])>_maxdate&&MAX('Table'[Finished])=BLANK(),1,0)
New Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Added])>=_mindate&&MAX('Table'[Added])<=_maxdate,1,0)

2. Place the four Measures in different Visual Filters and set is=1.

vyangliumsft_0-1691737994662.png

3. Result:

vyangliumsft_1-1691737994666.png

 

 

Best Regards,

Liu Yang

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @S_Berg ,

 

Sorry, as far as I know, it may not be possible to use only one measure to filter 4 Visual different date fields, which will cause conflicts in the conditions, you can create 4 measures and place them in different Visual settings is=1.

Here are the steps you can follow:

1. Create measure.

New Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Added])>=_mindate&&MAX('Table'[Added])<=_maxdate,1,0)
ACTIVE =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Status])>=_mindate&&MAX('Table'[Added])<=_maxdate&&MAX('Table'[Finished])=BLANK(),1,0)
Pending Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Status])<_mindate|| MAX('Table'[Added])>_maxdate&&MAX('Table'[Finished])=BLANK(),1,0)
New Projects =
var _mindate=MINX(ALLSELECTED('Date'),'Date'[Date])
var _maxdate=MAXX(ALLSELECTED('Date'),'Date'[Date])
return
IF(
    MAX('Table'[Added])>=_mindate&&MAX('Table'[Added])<=_maxdate,1,0)

2. Place the four Measures in different Visual Filters and set is=1.

vyangliumsft_0-1691737994662.png

3. Result:

vyangliumsft_1-1691737994666.png

 

 

Best Regards,

Liu Yang

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

Greg_Deckler
Super User
Super User

@S_Berg You need a Complex Selector. Re: The Complex Selector - Microsoft Fabric Community

 

Sample data and expected output would help to be more specific.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler,

 

Thank you for your response! I want to Create a tracker like this: 

S_Berg_1-1691612300539.png

 

Here is some sample data:

ProjectAddedDeadlineLeadCategoryStatusFinished
A1/10/2023 Person 1Infrastructure5/12/2023 
B2/24/2023 Person 2Response7/5/20237/5/2023
C2/1/20233/31/2023Person 3Customer6/23/2023

 

 

D3/31/202311/17/2023Person 4Admin5/12/2023 

 

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.