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

Cross filtering by Start & End Date

Hi,

 

I have two visuals, a table containing tasks (with Start & End dates) and a line chart showing costs. I'm trying to get it so that if I select a task, then the line chart is filtered to teh start & end date of the task. E.g. If I select Task1, then the line chart will be filtered to the costs incurred during the date range of Task1.

 

This would be even better if I could use a Gantt chart for the tasks instead of a table, but to my knowledge that is not possible.

 

So, any ideas?

 

StillLearning1_0-1681501689647.png

 

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

Hi, @StillLearning1 

According to your description, you want to filter the line chart when you select the task in table.

This is my test data:

vyueyunzhmsft_0-1681696261858.png

(1)We can create a measure like this:

Measure = var _start_date =  MIN('Task'[Start Date])
var _end_Date = MAX('Task'[End Date])
var _cur_date =  MAX('Table'[Date])
return
IF(_cur_date>=_start_date && _cur_date <= _end_Date ,  SUM('Table'[Value]), BLANK())

(2)Then we can put this measure on the line chart and the result is as follows:

vyueyunzhmsft_1-1681696309144.png

And for how to create a Gantt chart , you can refer to this :
How to Create a Gantt Chart in Power BI (Fast and Easy) (spreadsheeto.com)

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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-yueyunzh-msft
Community Support
Community Support

Hi, @StillLearning1 

According to your description, you want to filter the line chart when you select the task in table.

This is my test data:

vyueyunzhmsft_0-1681696261858.png

(1)We can create a measure like this:

Measure = var _start_date =  MIN('Task'[Start Date])
var _end_Date = MAX('Task'[End Date])
var _cur_date =  MAX('Table'[Date])
return
IF(_cur_date>=_start_date && _cur_date <= _end_Date ,  SUM('Table'[Value]), BLANK())

(2)Then we can put this measure on the line chart and the result is as follows:

vyueyunzhmsft_1-1681696309144.png

And for how to create a Gantt chart , you can refer to this :
How to Create a Gantt Chart in Power BI (Fast and Easy) (spreadsheeto.com)

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Thanks!

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.