<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Search from the end of the string in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1154742#M17632</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;It works greate!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tatevik&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 06:56:28 GMT</pubDate>
    <dc:creator>tatevikz</dc:creator>
    <dc:date>2020-06-12T06:56:28Z</dc:date>
    <item>
      <title>Search from the end of the string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152441#M17555</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue with searching in string using DAX.&lt;/P&gt;&lt;P&gt;Here is an example of a string where I need to find the last direcotry:&lt;/P&gt;&lt;P&gt;/Usr/agerbats/myproducts/ip/v-logic_gf22nsdvlogl36hdl116a/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone help me to solve this issue?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 09:01:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152441#M17555</guid>
      <dc:creator>tatevikz</dc:creator>
      <dc:date>2020-06-11T09:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Search from the end of the string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152910#M17558</link>
      <description>&lt;P&gt;This is amazingly difficult in DAX as the language has no recursivity concept (i think).&amp;nbsp; Does it have to be in DAX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, here's how I would do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;version a:&amp;nbsp; Your path before the last folder has a fixed length&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var path = "&lt;SPAN&gt;/Usr/agerbats/myproducts/ip/v-logic_gf22nsdvlogl36hdl116a/"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var lastfolder = right(path,len(path)-25)&lt;/P&gt;&lt;P&gt;return left(lastfolder,len(lastfolder)-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;version b: flexible length and depth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use SUBSTITUTE() to get rid of the first n slashes &lt;STRONG&gt;one by one&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var path = "&lt;SPAN&gt;/Usr/agerbats/myproducts/ip/v-logic_gf22nsdvlogl36hdl116a/"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s1=substitute(path,"/","(1)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s2=substitute(s1,"/","(2)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s3=substitute(s2,"/","(3)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s4=substitute(s3,"/","(4)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s5=substitute(s4,"/","(5)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var s6=substitute(s5,"/","(6)",1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This would give you s6 as&amp;nbsp;"(1)Usr(2)agerbats(3)myproducts(4)ip(5)v-logic_gf22nsdvlogl36hdl116a(6)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so on if you have deeper paths.&amp;nbsp; You would have to stop when variables are the same. Ie when s5 is the same as s6 that means there are only five slashes in the path.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After that you would use FIND or SEARCH to find "(5)" and extract the folder accordingly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:36:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152910#M17558</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-06-11T11:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Search from the end of the string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152947#M17560</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237803" data-lia-user-login="tatevikz" class="lia-mention lia-mention-user"&gt;tatevikz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can create a Calculated Column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Column = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var a =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUBSTITUTE('Table'[Column1],"/","|") &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;Var valuetoreturn = PATHITEMREVERSE(a,2)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;valuetoreturn&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:58:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1152947#M17560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-11T11:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Search from the end of the string</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1154742#M17632</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;It works greate!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tatevik&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 06:56:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-from-the-end-of-the-string/m-p/1154742#M17632</guid>
      <dc:creator>tatevikz</dc:creator>
      <dc:date>2020-06-12T06:56:28Z</dc:date>
    </item>
  </channel>
</rss>

