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

Measure not doing anything in filter

Hi,

 

I have a dataset which looks as follows

MilestoneMilestoneTypeMilestoneDateRaw
Gate 2 reachedForecastDate26/04/2017
Gate 3 reachedForecastDate17/09/2017
Gate 4 reachedForecastDate14/11/2018
Gate 5 reachedForecastDate14/11/2019
Gate 2 reachedActualDate15/05/2017
Gate 3 reachedActualDate14/11/2017
Gate 4 reachedActualDate 
Gate 5 reachedActualDate 

 

I am trying to create two measures, LastGate and NextGate.

 

LastGate is the most recent actual date and returns 14/11/2017

LastGate = 
CALCULATE(
	MAX(Fact_Milestones[MilestoneDateRaw]),
	Fact_Milestones[MilestoneType] = "ActualDate"
)

 

 

 

NextGate is the smallest forecast date which occurs after the last gate and looks as follows:

NextGate = 
CALCULATE(
	MIN(Fact_Milestones[MilestoneDateRaw]),
	Fact_Milestones[MilestoneType] = "ForecastDate",
	FILTER(
		ALL(Dim_Date[Date].[Date]),
		Dim_Date[Date].[Date] > [LastGate]
)
)

 

For some reason this returns 26/04/2017 which is just the smallest forecast date. Why does the LastGate measure not filter? Replacing it with DATE(2017,11,14) returns the desired result of 14/11/2018.

FILTER(
		ALL(Dim_Date[Date].[Date]),
		Dim_Date[Date].[Date] > DATE(2017,11,14)
)

 

Many thanks!

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

Please change your DAX to the following:

NextGate = var lastactualdate=[LastGate] 
return CALCULATE(
	MIN(Fact_Milestones[MilestoneDateRaw]),
	Fact_Milestones[MilestoneType] = "ForecastDate",
	FILTER(
		ALL(Dim_Date[Date]),
		Dim_Date[Date] > lastactualdate
)
)

1.PNG

Regards,
Lydia

Community Support Team _ Lydia 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-yuezhe-msft
Employee
Employee

@Anonymous,

Please change your DAX to the following:

NextGate = var lastactualdate=[LastGate] 
return CALCULATE(
	MIN(Fact_Milestones[MilestoneDateRaw]),
	Fact_Milestones[MilestoneType] = "ForecastDate",
	FILTER(
		ALL(Dim_Date[Date]),
		Dim_Date[Date] > lastactualdate
)
)

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

Is anyone able to help with this?

 

Many 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.