Remove everything after a character

,

similar to what @timshuwy said… although I thought you needed it in a calculated field in a BAQ. For a calculated field in BAQ:

left(Part.PartNum, charindex('-', Part.PartNum)) 

The above would return the first X characters of PartNum where X is the position of the hyphen/dash character. If there is no hyphen/dash, it should return the entire partnumber. Replace the hyphen/dash with whatever character you’re looking for. Also replace the table you’re looking in if it’s not Part.

3 Likes