<?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 UK PostCode to Area Code in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/UK-PostCode-to-Area-Code/m-p/2060188#M46471</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to break down the UK postcode into an area code. For example, SE27 9HR to SE27.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a solution for a DAX command to return the first 2 characters (in this case SE) but I'd like the number as well. This was the solution:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;POSTCODEnew&amp;nbsp;=
IF&amp;nbsp;(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RIGHT&amp;nbsp;(&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;2&amp;nbsp;),&amp;nbsp;1&amp;nbsp;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;IN&amp;nbsp;{&amp;nbsp;"0",&amp;nbsp;"1",&amp;nbsp;"2",&amp;nbsp;"3",&amp;nbsp;"4",&amp;nbsp;"5",&amp;nbsp;"6",&amp;nbsp;"7",&amp;nbsp;"8",&amp;nbsp;"9"&amp;nbsp;},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;1&amp;nbsp;),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;2&amp;nbsp;)
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, some postcodes have 3 characters at the start instead of 4 e.g. E14 0RW. So is there a DAX command to return whatever is in front of the break between the 2 sets of characters.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Sep 2021 16:03:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-09-06T16:03:01Z</dc:date>
    <item>
      <title>UK PostCode to Area Code</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/UK-PostCode-to-Area-Code/m-p/2060188#M46471</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to break down the UK postcode into an area code. For example, SE27 9HR to SE27.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a solution for a DAX command to return the first 2 characters (in this case SE) but I'd like the number as well. This was the solution:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;POSTCODEnew&amp;nbsp;=
IF&amp;nbsp;(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RIGHT&amp;nbsp;(&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;2&amp;nbsp;),&amp;nbsp;1&amp;nbsp;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;IN&amp;nbsp;{&amp;nbsp;"0",&amp;nbsp;"1",&amp;nbsp;"2",&amp;nbsp;"3",&amp;nbsp;"4",&amp;nbsp;"5",&amp;nbsp;"6",&amp;nbsp;"7",&amp;nbsp;"8",&amp;nbsp;"9"&amp;nbsp;},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;1&amp;nbsp;),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LEFT&amp;nbsp;(&amp;nbsp;'UK&amp;nbsp;Post&amp;nbsp;Code'[POSTCODEold],&amp;nbsp;2&amp;nbsp;)
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, some postcodes have 3 characters at the start instead of 4 e.g. E14 0RW. So is there a DAX command to return whatever is in front of the break between the 2 sets of characters.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 16:03:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/UK-PostCode-to-Area-Code/m-p/2060188#M46471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-06T16:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: UK PostCode to Area Code</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/UK-PostCode-to-Area-Code/m-p/2060218#M46475</link>
      <description>&lt;P&gt;Hello there&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;! Wouldn't it be easier for you to do this in Power Query Editor with either the "split column" function or the "extract" function?&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;Alternatively, you can also try this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ColumnB = 
Var FirstSpace = FIND(" ";'UK Post Code'[POSTCODEold]) 
Return 
LEFT('UK Post Code'[POSTCODEold]; LEN('UK Post Code'[POSTCODEold]) - FirstSpace)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this answer solves your problem! If you need any additional help please tag me in your reply.&lt;BR /&gt;If my reply provided you with a solution, pleased mark it as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; or give it a kudoe &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Gonçalo Geraldes&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 16:16:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/UK-PostCode-to-Area-Code/m-p/2060218#M46475</guid>
      <dc:creator>goncalogeraldes</dc:creator>
      <dc:date>2021-09-06T16:16:28Z</dc:date>
    </item>
  </channel>
</rss>

