Forum Discussion
Anonymous
3 years agoNot applicable
DAX Measure Error on Search Function
Hi Experts
I cannot see my error on the SEARCH VAR in the following
Error Message
Measure =
VAR _USERPRINCIPALNAME = CONCATENATE(SELECTEDVALUE(pg_control_cases[country_dim.country_name]),SELECTEDVALUE(pg_control_cases[store_name]))
VAR SeparatorPosition = SEARCH(",",_USERPRINCIPALNAME)
VAR _Country = LEFT(_USERPRINCIPALNAME, SeparatorPosition - 1)
VAR _Store = RIGHT(_USERPRINCIPALNAME, SeparatorPosition + 1)
RETURN
SeparatorPosition
- Anonymous3 years ago
thanks, getting a 0 - surely this should be 1
VAR SeparatorPosition = SEARCH(",",_USERPRINCIPALNAME,1,0)
2 Replies
- ppm1Solution Sage
You can provide values for the 3rd and 4th terms in the SEARCH function to avoid that. The 4th is the not found value. Usually people put 1 for the start position and 0 for not found.
Pat
- AnonymousNot applicable
thanks, getting a 0 - surely this should be 1
VAR SeparatorPosition = SEARCH(",",_USERPRINCIPALNAME,1,0)