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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
yuvi12
Frequent Visitor

Help for Date range slicer only affect the data bars not data.

when users select a date range using the slicer, the Gantt chart will dynamically adjust to display only the project activities that fall within the selected date range while still showing all projects. Projects that don't have any activities within the selected date range will appear as empty bars on the Gantt chart.

3 REPLIES 3
DallasBaba
Skilled Sharer
Skilled Sharer

Hi @yuvi12 ,

 Try this steps

 

Insert a Gantt chart visual into your Power BI report.


Drag and drop the project name or ID into the "Values" field well of the Gantt chart visual.


Drag the activity start date and activity end date into the "StartDate" and "EndDate" field wells of the Gantt chart visual.

 

Click on the Gantt chart visual to select it.
Go to the "Format" pane.
Under the "Filters" section, select the "Filters on this visual" option.
Click on the date column you added to the slicer to create a filter.
Choose the "Between" filter type.
This will filter the Gantt chart based on the selected date range.

To display projects that don't have any activities within the selected date range as empty bars, you'll need to create a measure to calculate the status of each project within the date range.

Go to the "Modeling" tab in Power BI.


Click on "New Measure" and create a DAX measure that checks if any activities for a project fall within the selected date range.

 

For example:
ProjectStatus =
IF (
MIN(YourActivityTable[StartDate]) >= MIN(DateSlicer[Date]) &&
MAX(YourActivityTable[EndDate]) <= MAX(DateSlicer[Date]),
"In Range",
"Out of Range"
)


Drag and drop the "ProjectStatus" measure you created into the "Values" field well of the Gantt chart visual.
Set the aggregation for this measure to "Don't Summarize."

Let me know id this work, and if not please share a screenshort with the problem. 

 

Thanks

Babatunde Dallas

Thanks
Dallas
Sahir_Maharaj
Super User
Super User

Hello @yuvi12,

 

Here is a basic guide that might assist:

 

1. Ensure your data has columns for ProjectName, ActivityStartDate, and ActivityEndDate. Create a a slicer visual onto your canvas and use the ActivityStartDate as the field.

2. Use a Gantt chart custom visual from the Power BI marketplace if you haven't already done so

3. This is the trickier part. You want the Gantt chart to show all projects but only highlight the activities within the selected date range:

Filtered Start Date = 
IF(
    MIN('Table'[ActivityStartDate]) >= MIN(SlicerTable[ActivityStartDate]) && 
    MAX('Table'[ActivityEndDate]) <= MAX(SlicerTable[ActivityEndDate]),
    MIN('Table'[ActivityStartDate]),
    BLANK()
)

Filtered End Date = 
IF(
    MIN('Table'[ActivityStartDate]) >= MIN(SlicerTable[ActivityStartDate]) && 
    MAX('Table'[ActivityEndDate]) <= MAX(SlicerTable[ActivityEndDate]),
    MAX('Table'[ActivityEndDate]),
    BLANK()
)

Should you require any further assistance, please do not hesitate to reach out to me.


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

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

This approach didn't work for me because I only have one date dimension field to slice the data. How can I obtain the start and end dates for the slicer in the report? Currently, the report shows nothing, and there is no relationship between the slicer date field and the activity date fields. In the past, I used the date range concept, but the use case is different now.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.