I’m creating a cube and the person who wrote the software made a productSize field in the data a varchar(50) instead of a numeric data type. It is also unusual in that it might, for instance, contain a 9 or a 4.5×2. Can a calculated measure convert the varchar to a decimal in this situation?
Edit: Now I realize I can create a Named Calculation by right clicking the table column in the DSV. I still need to figure out how to code the expression though. This is all I have so far…
CASE
WHEN SUBSTRING(ProductSize, 2,1) = 'x' THEN 0 // detects an 'x' in char 2 but I need to detect an x anywhere, and verify the string can be converted to a number
ELSE
cast(ProductSize as DECIMAL)
END
The answer to my question was a simple in that I just use SQL to create a Named Calculation in the DataSet view. As stated above, it is just a matter of creating a parse statement using SQL syntax. The following expression works for now.