Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

SplitText by variable number of backslashes DAX Measure

Hi All,

 

Need help with my DAX. I need to be able to extract just the "Sprint ##" part from my text field

 

My text field format can be like any of the below examples

 

Team_Name\Project Name\Queue Name\Sprint 1
Team_Name\Project Name\Sprint 10
Team_Name\Queue Name\Sprint 35
Team_Name\Sprint 54

 

As you can see the number of backslashes changes, so I created the below code to turn the right most backslash into an "@", so that then I could use MID and FIND to identify and split the "Sprint ##" part out

 

IP_Sprint =

SUBSTITUTE(SELECTEDVALUE('View for PBI Report'[Iteration Path]),"\","@",
        LEN(SELECTEDVALUE('View for PBI Report'[Iteration Path]))
        -LEN(SUBSTITUTE(SELECTEDVALUE('View for PBI Report'[Iteration Path]),"\","")))

 

The above code works but I get the below error when I try to do MID(IP_Sprint,FIND("@",IP_Sprint,1)+1,10)

 

Can anyone please help me resolve the issue

 

  • Hi  Anonymous  It seems some kind of Bug in system. Find function is working fine if we are giving optional 4th parameter for "NotFoundValue" value. Please try below. Change "-1" as per you deem fit.

    https://docs.microsoft.com/en-us/dax/find-function-dax

     MID([IP_Sprint],FIND("@",[IP_Sprint],1,-1)+1,10) 

     

    Thanks
    Ankit Jain
    Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.

     

     

     

     

    Anonymous

4 Replies