You should be able to use RegexpMatch which returns Boolean along with Sum to achieve your result.
I think this put me on the right track. I had to do some research but believe that REGEXP_EXTRACT_NTH 'should' work.
I have tested this regex with a few tools and it appears to be valid but using it in Tableau returns null values.
What I think this should do is find the last value of a string which starts with '#' in my dimension.
But when used in Tableau I get NULL values.
IF REGEXP_EXTRACT_NTH([DValue],'(#*)#.*',-1) = '#hash2' then 'TEXT VALUE'
Any ideas? Thanks...