<?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: Haversine formula across tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714865#M1182</link>
    <description>&lt;P&gt;Hi Roger,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the function RELATED to use a value from a table on the "one side" of the relationship.&lt;BR /&gt;&lt;BR /&gt;This means you could create a calculation like;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COS(vwLB_Incident[Lat2]*RELATED('Station Locations'[Lat1]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Let me know if this solves your challenge.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 14 Jun 2019 06:33:06 GMT</pubDate>
    <dc:creator>avanderschilden</dc:creator>
    <dc:date>2019-06-14T06:33:06Z</dc:date>
    <item>
      <title>Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714093#M1147</link>
      <description>&lt;P&gt;I recently asked a question but think it was the wrong question so will take it back a step and see how you would do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate the distance between two lat/long points at sea (so in nautical miles).&amp;nbsp; The problem I have is that one set of lat/longs is in one table, and the other location is in another.&amp;nbsp; The formula i would normally use with all the lat/longs n the same table is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ACOS(COS(RADIANS(90-Lat1)) * COS((RADIANS(90-Lat2)) + SIN((RADIANS(90-Lat1)) * SIN((RADIANS(90-Lat2)) * COS(RADIANS(Lng1-Lng2))) * 3440.065)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But i am not sure how to amend this so that it can read across two tables.&amp;nbsp; Lat1 and Long1 reside in a table called "Station Locations" and Lat2 and Long2 reside in "LB_Incident" table.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any idea on the best way to do this?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Jun 2019 13:12:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714093#M1147</guid>
      <dc:creator>rogerdea</dc:creator>
      <dc:date>2019-06-13T13:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714372#M1164</link>
      <description>&lt;P&gt;Hi Roger,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you be able to provide a screenshot of the data model? I would like to see the relationship between those two tables you refer to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adrian&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 17:58:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714372#M1164</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-06-13T17:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714823#M1181</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 06:08:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714823#M1181</guid>
      <dc:creator>rogerdea</dc:creator>
      <dc:date>2019-06-14T06:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714865#M1182</link>
      <description>&lt;P&gt;Hi Roger,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the function RELATED to use a value from a table on the "one side" of the relationship.&lt;BR /&gt;&lt;BR /&gt;This means you could create a calculation like;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COS(vwLB_Incident[Lat2]*RELATED('Station Locations'[Lat1]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Let me know if this solves your challenge.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 Jun 2019 06:33:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/714865#M1182</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-06-14T06:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716374#M1235</link>
      <description>&lt;P&gt;Thanks very much, it's worked in as much as i can select the columns from the other tables in DAX (but only into a new column and not a new measure).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm still getting an error though.&amp;nbsp; I noticed the last related statement is greyed out, is this the issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 07:49:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716374#M1235</guid>
      <dc:creator>rogerdea</dc:creator>
      <dc:date>2019-06-17T07:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716387#M1236</link>
      <description>You are using RELATED on a column that already exist in the current table.&lt;BR /&gt;Close the RELATED funtion before you subtract the column that already is available without RELATED.</description>
      <pubDate>Mon, 17 Jun 2019 07:57:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716387#M1236</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-06-17T07:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716410#M1237</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="144365" data-lia-user-login="avanderschilden" class="lia-mention lia-mention-user"&gt;avanderschilden&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I fixed that issue but still having trouble with the usual error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 08:12:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716410#M1237</guid>
      <dc:creator>rogerdea</dc:creator>
      <dc:date>2019-06-17T08:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716422#M1238</link>
      <description>If you want to create a measure instead of a calculated column, you have to use an aggregator. If you for example use the AVERAGEX iterator you will have access to RELATED columns.&lt;BR /&gt;&lt;BR /&gt;For example;&lt;BR /&gt;&lt;BR /&gt;MEASURE =&lt;BR /&gt;AVERAGEX ( vwLB_Incident, COS ( RELATED ( ...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Jun 2019 08:28:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716422#M1238</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-06-17T08:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716486#M1240</link>
      <description>&lt;P&gt;Thanks again.&amp;nbsp; I tried this as a measure but i am back to my original error.&amp;nbsp; sorry for all the questions.&amp;nbsp; any more ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 09:27:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716486#M1240</guid>
      <dc:creator>rogerdea</dc:creator>
      <dc:date>2019-06-17T09:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Haversine formula across tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716498#M1242</link>
      <description>&lt;P&gt;I created a measure that is quite similar (some "(" and ")" on different place) and don't get any errors;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please review your code, because as you can see in my measure, RELATED works completely fine.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 09:39:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Haversine-formula-across-tables/m-p/716498#M1242</guid>
      <dc:creator>avanderschilden</dc:creator>
      <dc:date>2019-06-17T09:39:49Z</dc:date>
    </item>
  </channel>
</rss>

