Forum Discussion
cannot find name
Hello Everyone !
im having a trouble in formula where the column name cannot be found ,
i have table called Yard Loading that has column "Start Date", but when i put inside the formula, an error arise.
Norms Value =
VAR CurrentMonth = [Current Month]
VAR MonthsSinceStart = [CurrentMonthSinceStart]
VAR ProjectDuration = [Duration (Month)]
RETURN
IF(
ISBLANK(MonthsSinceStart) || ISBLANK(ProjectDuration),
BLANK(),
CALCULATE(
SWITCH(
TRUE(),
CurrentMonth - MONTH('Yard Loading'[Start Date]") + 1 > ProjectDuration, BLANK(), -- If current month exceeds project duration, return blank
CurrentMonth - MONTH('Yard Loading'[Start Date]) + 1 = 1, 'Norm Loading'[Month1],
CurrentMonth - MONTH('Yard Loading'[Start Date]) + 1 = 2, 'Norm Loading'[Month2],
CurrentMonth - MONTH('Yard Loading'[Start Date]) + 1 = 3, 'Norm Loading'[Month3]
),
FILTER('Norm Loading', 'Norm Loading'[Month] = CurrentMonth - MONTH('Yard Loading'[Start Date]) + 1)
)
)
the error only happen in SWITCH().
Thank you in advance
I already find a solution for my issue, where instead of doing hard code like above, i forget that i can simply use relationship in model view and its done
3 Replies
- lukiz84Memorable Member
and the error is?
it's not "cannot find" but "cannot find a single value" because you have to use min/max or any other function to get a single value
- AnonymousNot applicable
Hi butterscotch ,
Please replace MONTH('Yard Loading'[Start Date]) with MONTH(SELECTEDVALUE('Yard Loading'[Start Date]))
Or MONTH(MAX('Yard Loading'[Start Date]))
Replace 'Norm Loading'[Month 1] with SELECTEDVALUE('Norm Loading'[Month 1])
Or MAX('Norm Loading'[Month 1])
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- butterscotchHelper II
I already find a solution for my issue, where instead of doing hard code like above, i forget that i can simply use relationship in model view and its done