<?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 Creating a function within Power BI in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385645#M11452</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a function I use in excel (I can post if you like but its quite a lot of text). Is there anyway I can call this in power BI or re-create this in Power BI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the basics of the function is to check if lat and long co-ords are within a reasonable area of the postcode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Snippet of function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function testCoords(PC, IRCLat, IRCLong)&lt;/P&gt;&lt;P&gt;Dim OC(578) As String&lt;/P&gt;&lt;P&gt;Dim LatMax(578) As Double&lt;/P&gt;&lt;P&gt;Dim LatMin(578) As Double&lt;/P&gt;&lt;P&gt;Dim LongMin(578) As Double&lt;/P&gt;&lt;P&gt;Dim LongMax(578) As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OC(1) = "B1": LatMax(1) = 52.495956: LatMin(1) = 52.472609: LongMax(1) = -1.894214: LongMin(1) = -1.922561&lt;/P&gt;&lt;P&gt;OC(2) = "B10": LatMax(2) = 52.477985: LatMin(2) = 52.459173: LongMax(2) = -1.828649: LongMin(2) = -1.877087&lt;/P&gt;&lt;P&gt;OC(3) = "B11": LatMax(3) = 52.472108: LatMin(3) = 52.443094: LongMax(3) = -1.826494: LongMin(3) = -1.881428&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;testCoords = "Valid"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IRCOC = Left(PC, InStr(PC, " ") - 1)&lt;/P&gt;&lt;P&gt;OcIndex = 0&lt;/P&gt;&lt;P&gt;For X = 1 To 578&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If OC(X) = IRCOC Then OcIndex = X: X = 579&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;If OcIndex = 0 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; testCoords = "Invalid Postcode"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Function&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If LatMax(OcIndex) &amp;lt; IRCLat Or LatMin(OcIndex) &amp;gt; IRCLat Or LongMax(OcIndex) &amp;lt; IRCLong Or LongMin(OcIndex) &amp;gt; IRCLong _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Then testCoords = "Incorrect Lat/Long"&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 14:29:16 GMT</pubDate>
    <dc:creator>carlm1975</dc:creator>
    <dc:date>2018-03-28T14:29:16Z</dc:date>
    <item>
      <title>Creating a function within Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385645#M11452</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a function I use in excel (I can post if you like but its quite a lot of text). Is there anyway I can call this in power BI or re-create this in Power BI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the basics of the function is to check if lat and long co-ords are within a reasonable area of the postcode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Snippet of function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function testCoords(PC, IRCLat, IRCLong)&lt;/P&gt;&lt;P&gt;Dim OC(578) As String&lt;/P&gt;&lt;P&gt;Dim LatMax(578) As Double&lt;/P&gt;&lt;P&gt;Dim LatMin(578) As Double&lt;/P&gt;&lt;P&gt;Dim LongMin(578) As Double&lt;/P&gt;&lt;P&gt;Dim LongMax(578) As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OC(1) = "B1": LatMax(1) = 52.495956: LatMin(1) = 52.472609: LongMax(1) = -1.894214: LongMin(1) = -1.922561&lt;/P&gt;&lt;P&gt;OC(2) = "B10": LatMax(2) = 52.477985: LatMin(2) = 52.459173: LongMax(2) = -1.828649: LongMin(2) = -1.877087&lt;/P&gt;&lt;P&gt;OC(3) = "B11": LatMax(3) = 52.472108: LatMin(3) = 52.443094: LongMax(3) = -1.826494: LongMin(3) = -1.881428&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;testCoords = "Valid"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IRCOC = Left(PC, InStr(PC, " ") - 1)&lt;/P&gt;&lt;P&gt;OcIndex = 0&lt;/P&gt;&lt;P&gt;For X = 1 To 578&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If OC(X) = IRCOC Then OcIndex = X: X = 579&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;If OcIndex = 0 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; testCoords = "Invalid Postcode"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Function&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;If LatMax(OcIndex) &amp;lt; IRCLat Or LatMin(OcIndex) &amp;gt; IRCLat Or LongMax(OcIndex) &amp;lt; IRCLong Or LongMin(OcIndex) &amp;gt; IRCLong _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Then testCoords = "Incorrect Lat/Long"&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:29:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385645#M11452</guid>
      <dc:creator>carlm1975</dc:creator>
      <dc:date>2018-03-28T14:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a function within Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385648#M11453</link>
      <description>&lt;P&gt;You may check out the&amp;nbsp;&lt;A href="https://msdn.microsoft.com/en-us/library/ee634396.aspx" target="_self"&gt;DAX Function Reference&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:35:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385648#M11453</guid>
      <dc:creator>az2451</dc:creator>
      <dc:date>2018-03-28T14:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a function within Power BI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385652#M11454</link>
      <description>&lt;P&gt;Thanks for the pointer but i still do not know where to start&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:40:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-a-function-within-Power-BI/m-p/385652#M11454</guid>
      <dc:creator>carlm1975</dc:creator>
      <dc:date>2018-03-28T14:40:03Z</dc:date>
    </item>
  </channel>
</rss>

