-
1. Re: Expected end to match case at Character 0'
Hari Ankem Nov 28, 2018 1:01 PM (in response to patty.yang)Just add an END at the bottom.
case [Select a Measure]
WHEN 'Count' then
If attr([Outcome Year]) = 'After Year 1'
then sum([Attrit After Yr 1])
ELSEIF attr([Outcome Year]) = 'After Year 2'
THEN sum([Attrit After Yr 2])
ELSEif attr([Outcome Year]) = 'After Year 3'
THEN sum([Attrit After Yr 3])
END
WHEN 'Percent' then
If attr([Outcome Year]) = 'After Year 1'
then STR(ROUND(SUM([Attrit After Yr 1])/TOTAL(SUM([Attrit After Yr 1]))*100,2))
ELSEIF attr([Outcome Year]) = 'After Year 2'
then STR(ROUND(SUM([Attrit After Yr 2])/TOTAL(SUM([Attrit After Yr 2]))*100,2))
ELSEIF attr([Outcome Year]) = 'After Year 3'
then STR(ROUND(SUM([Attrit After Yr 3])/TOTAL(SUM([Attrit After Yr 3]))*100,2))
else null
END
END
-
2. Re: Expected end to match case at Character 0'
Joe OppeltNov 28, 2018 1:02 PM (in response to patty.yang)
You have the correct END for each IF clause.
You need one more END at the end of it all for the CASE statement itself.CASE [whatever]
WHEN "X" then "something"
WHEN "y" then "Something Else"
END -
3. Re: Expected end to match case at Character 0'
patty.yang Nov 28, 2018 1:08 PM (in response to patty.yang) -
4. Re: Expected end to match case at Character 0'
Ken Flerlage Nov 28, 2018 1:09 PM (in response to patty.yang)You need ENDs after both your IF statements and your CASE.
-
5. Re: Expected end to match case at Character 0'
Ken Flerlage Nov 28, 2018 1:10 PM (in response to patty.yang)Can you attach a packaged workbook? I fear there are a few different problems here.
-
6. Re: Expected end to match case at Character 0'
Joe OppeltNov 28, 2018 1:10 PM (in response to patty.yang)
Oh. in the upper half od the calc you are loading SUM(stuff) and in the bottom half its STR(stuff).
It has to be all numeric or all string.
-
7. Re: Expected end to match case at Character 0'
patty.yang Nov 28, 2018 1:19 PM (in response to Joe Oppelt)Thanks Joe! that worked! but since i am using the parameter to swapping the measures, then the number format becomes the issue.
in the percent, it looked ok because i changed the number format to percentage but if i swap back to count, the number is crazy... do you happen to have a way to make the number format dynamic?
-
8. Re: Expected end to match case at Character 0'
Joe OppeltNov 28, 2018 1:25 PM (in response to patty.yang)
I would take the formatting off the axis numbers. (Just have 20, 40, 60, etc on the percents and 10000, 20000, etc on the big number.)
And if you make everything string in the calc, you can format the string however you want based on the parameter selection. Just build the % into the overall string right in the calc.
But if you really need the formatting in the axis, then I would look at making two sheets and swap them based on the value of the parameter. (It's a common technique. Two sheets occupy the same container, but only one of them displays at a time.)
You can find video examples of how to sheet swap here: