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

Rolling 6months on Gantt chart

Hi

Is it possible to get solution for my requirement in power bi? I tried in all the ways still not able to find solution so seeking expert suggestions.

I am using Gantt chart (imported) and have columns Start Date and end date, product name, activity name. I have start and end date in my slicers as well. When I select start date as 1/1/2020 my Gantt chart has to show from selected date to 6months ex Jan 2020 to June 2020. If user selects end date as 1/8/2020 then Gantt chart has to show Mar2020 to Aug2020. If user selects between range that range only has to show and default start date is current date and end date is 6months.

If user selecting more than 6months then have to show popup message or error message saying that pls select 6months.

 

I don't have any measure here. And most important thing is start and end date both are coming from same table. I tried with disconnected table but everyone used measure in the existing posts which I got from Google.

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

Hi @Anonymous ,

 

Try to redefine the start date and end date based on the slicer value to determine the range.

__start date = 
VAR x = SELECTEDVALUE(Sheet4[End Date])
VAR __year = YEAR(x)
VAR __month = MONTH(x)-5
VAR __day = DAY(x)
RETURN
IF(
    __month < 0,
    DATE( __year-1, __month+12,__day),
    DATE( __year, __month, __day)
)
__end date = 
VAR x = SELECTEDVALUE(Sheet4[Start Date])
VAR __year = YEAR(x)
VAR __month = MONTH(x)+5
VAR __day = DAY(x)
RETURN
IF(
    __month > 12,
    DATE( __year+1, __month-12,__day),
    DATE( __year, __month, __day)
)

v-lionel-msft_0-1603784990238.png

 

Best regards,
Lionel Chen

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

14 REPLIES 14

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.

Top Solution Authors