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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Set a measure equal to a filtered value of a different subset of that data???

I'm not even 100% sure how to explain what I want to do here, so if there is a less complicated way to get where I'm going, PLEASE chime in. But essentially I have data that looks like this:

 

ProjectDecision PointTarget DateActual Date
1A1/14/20192/11/2019
1B4/26/20195/2/2019
1C4/28/20204/16/2020
1D10/12/2020 
1E10/27/2020 
2...  

 

I want to make a gantt chart of this data where I mostly use the Actual date of the decision point PRIOR as the start Date and the Actual Date of the Decision Point as the End Date, unless there is no actual date, then I want use the Target Date. (Or unless it's DP A where I have to use the Target date as the start date right now because we haven't been capturing a start date of projects yet)

 

So in this case, I would want the Date Variables to be as listed below. Is there a good way for me to be able to create these Start and End Date Variables?

 

ProjectDecision PointStart Date End Date
1A1/14/20192/11/2019
1B2/11/20195/2/2019
1C5/2/20194/16/2020
1D4/16/202010/12/2020
1E10/12/202010/27/2020

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Source table "Gantt":

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkN9QxN9IwNDSyDbSN/QEMKO1YGocAJioLQZTIWpvhGqAmeIAgugqJEBmG1oBmHDVLiALDHQNzSCKVGAS7lCpIzMkaRiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, #"Decision Point" = _t, #"Target Date" = _t, #"Actual Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Target Date", type date}, {"Actual Date", type date}})
in
    #"Changed Type"

 

 

Calculated columns (note that Start Date depends on End Date so End Date needs to be defined first)

 

 

End Date = COALESCE(Gantt[Actual Date],Gantt[Target Date])

Start Date = 
var d = Gantt[Decision Point]
return if(d="A",Gantt[Target Date],CALCULATE(max(Gantt[End Date]),all(Gantt),Gantt[Decision Point]<d))

 

 

Result:

lbendlin_0-1601685428200.png

 

Note: this does not include the project filter. I leave that exercise up to you.

 

 

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Source table "Gantt":

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkN9QxN9IwNDSyDbSN/QEMKO1YGocAJioLQZTIWpvhGqAmeIAgugqJEBmG1oBmHDVLiALDHQNzSCKVGAS7lCpIzMkaRiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, #"Decision Point" = _t, #"Target Date" = _t, #"Actual Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Target Date", type date}, {"Actual Date", type date}})
in
    #"Changed Type"

 

 

Calculated columns (note that Start Date depends on End Date so End Date needs to be defined first)

 

 

End Date = COALESCE(Gantt[Actual Date],Gantt[Target Date])

Start Date = 
var d = Gantt[Decision Point]
return if(d="A",Gantt[Target Date],CALCULATE(max(Gantt[End Date]),all(Gantt),Gantt[Decision Point]<d))

 

 

Result:

lbendlin_0-1601685428200.png

 

Note: this does not include the project filter. I leave that exercise up to you.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors