<?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: DAX TREATAS column order in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-TREATAS-column-order/m-p/1041187#M13954</link>
    <description>This code is not too great. Instead of using TREATAS, please use SELECTCOLUMNS. Also, instead of using LEFTOUTER..., you should create the right relationship between the tables.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
    <pubDate>Wed, 22 Apr 2020 07:53:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-04-22T07:53:00Z</dc:date>
    <item>
      <title>DAX TREATAS column order</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-TREATAS-column-order/m-p/1040661#M13943</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report inherited from a previous colleague which includes a table created by a DAX statement.&amp;nbsp; I have narrowed the problem down to the DAX table which is not returning any data when it looks like it should.&amp;nbsp; I have checked the underlying tables (both in the database and also as they show in the PowerBI query section) and the raw data is coming through fine.&amp;nbsp; I am very new to DAX but I believe it comes down to the ordering of the columns coming out of a NATURALLEFTOUTERJOIN which is then used as input into a TREATAS function.&amp;nbsp; It is written in the following form:-&lt;/P&gt;&lt;P&gt;&amp;nbsp; ResultTable =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR A = ALL ( SourceTab[KeyCol] )&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR B = NATURALLEFTOUTERJOIN ( A, SourceTab2 )&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR C = TREATAS ( B, Tab1[Col1], Tab2[Col2], .... )&lt;/P&gt;&lt;P&gt;&amp;nbsp; RETURN C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cutting back the DAX, if I remove the VAR C section and have it RETURN B, I get data returned.&amp;nbsp; As soon as I add the VAR C section back it no longer returns data but does not error the DAX syntax.&amp;nbsp; This tells me the right number of columns are defined in the TREATAS but that they might to be in the wrong order.&amp;nbsp; Is this a reasonable assumption?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so how can I either:&lt;/P&gt;&lt;P&gt;a)&amp;nbsp; determine the order of the columns returned in VAR B so I can then map them correctly in VAR C&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;b)&amp;nbsp; force the order of the columns returned in VAR B so I can map them correctly in VAR C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 03:04:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-TREATAS-column-order/m-p/1040661#M13943</guid>
      <dc:creator>DarrylC</dc:creator>
      <dc:date>2020-04-22T03:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX TREATAS column order</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-TREATAS-column-order/m-p/1041187#M13954</link>
      <description>This code is not too great. Instead of using TREATAS, please use SELECTCOLUMNS. Also, instead of using LEFTOUTER..., you should create the right relationship between the tables.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Wed, 22 Apr 2020 07:53:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-TREATAS-column-order/m-p/1041187#M13954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-22T07:53:00Z</dc:date>
    </item>
  </channel>
</rss>

