Forum Discussion
Rimo72
3 years agoNew Member
Issues with string manipulation script
Hi, I don't understand what i'm doing wrong. I'm appling this code to a new column called TW TW = IF(ISBLANK('Tickets'[TimeWorked]), BLANK(), IF (SEARCH("(", 'Tickets'[TimeWorked],1,B...
- Anonymous3 years ago
Hi Rimo72 ,
The issue is likely with your SEARCH function. When SEARCH can't find the value (e.g. if the row value is blank) this kind of error can appear within LEFT.
You just need adjust your dax formula, please try below dax formula:
TW = IF ( ISBLANK ( 'Table'[Time Worked] ), BLANK (), IF ( SEARCH ( "(", 'Table'[Time Worked], 1, BLANK () ), MID ( 'Table'[Time Worked], SEARCH ( "(", 'Table'[Time Worked], 1, BLANK () ) + 1, SEARCH ( "min", 'Table'[Time Worked], 1, BLANK () ) - SEARCH ( "(", 'Table'[Time Worked], 1, BLANK () ) - 2 ), IF ( ISBLANK ( SEARCH ( "min", 'Table'[Time Worked], 1, BLANK () ) ), BLANK (), LEFT ( 'Table'[Time Worked], SEARCH ( "min", 'Table'[Time Worked], 1, BLANK () ) - 2 ) ) ) )Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.