
Here is the calculation:
IF FIND(STR([24HR POTW Orig]),'.') = 0 THEN STR([24HR POTW Orig])+'.000'
ELSEIF FIND(STR([24HR POTW Orig]),'.') >= 1 AND LEN(SPLIT(STR([24HR POTW Orig]),'.',2)) <= 3 THEN LEFT(STR([24HR POTW Orig]),FIND(STR([24HR POTW Orig]),'.')+3)+'0')
ELSE LEFT(STR([24HR POTW Orig]),FIND(STR([24HR POTW Orig]),'.')+4))
END
Here is a picture of Tableau saying there is an error
The field in question is a INT field, I am turning it into a string to do a FIND on the . and if there isn't one, it should return a 0.
Tableau really needs to do a better job on their errors. This makes no sense and it is so undescriptive that I have been bashing my head against this error for an hour and it is the same regardless of using CASE or IF and CONTAINS or FIND.
@Ryan Pulley
Hi, I guess you have two extra closing parenthesis in line two and three
IF FIND(STR([24HR POTW Orig]),'.') = 0 THEN STR([24HR POTW Orig])+'.000'
ELSEIF FIND(STR([24HR POTW Orig]),'.') >= 1 AND LEN(SPLIT(STR([24HR POTW Orig]),'.',2)) <= 3 THEN LEFT(STR([24HR POTW Orig]),FIND(STR([24HR POTW Orig]),'.')+3)+'0'
ELSE LEFT(STR([24HR POTW Orig]),FIND(STR([24HR POTW Orig]),'.')+4)
END
If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.
Regards,
Diego Martinez
Tableau Visionary and Forums Ambassador