Forum Discussion
aallman
4 years agoHelper II
Issue with Value() function converting string to number
I am using a switch formula to simplify and bucket a column of mixed numeric and text values. The goal is to simplify values that are numeric with text to just the number. (For example, I have these ...
aallman
4 years agoHelper II
The issue is that it is not returning an error like it should. ISERROR(VALUE("2a")) should return TRUE but it returns FALSE. See the attached screenshots.
here is a small sample of the values in the column I am working with:
This column is a string column and the column I am creating is also a string column. I did some replace fucntions to remove blank spaces and "g" and "G" (because those are the most common units attached to the end of my numeric values).
tamerj1
4 years agoCommunity Champion
Hi aallman
Please follow these steps
Numbers =
SELECTCOLUMNS (
UNION (
GENERATESERIES ( 0, 9, 1 ),
{ "." }
),
"Digit",
[Value]
)Value =
VAR String = 'Table'[MyColumn]
VAR Length = LEN ( String )
VAR T1 = GENERATESERIES ( 1, Length, 1 )
VAR T2 = ADDCOLUMNS ( T1, "@Letter", MID ( String, [Value], 1 ) )
VAR T3 = FILTER ( T2, [@Letter] IN VALUES ( Numbers[Digit] ) )
RETURN
VALUE ( CONCATENATEX ( T3, [@Letter],, [Value], ASC ) )