<?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: How to Extract just column headers from a table in Power BI? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3978331#M154252</link>
    <description>&lt;P class="lia-align-left"&gt;The data structure is the opposite of what Power BI likes.&amp;nbsp; Your requirement cannot be fulfilled in DAX as there is no way in DAX to dynamically address columns of a table.&lt;/P&gt;
&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;You have to use Power Query to bring the data into a usable format by unpivoting the year columns.&amp;nbsp; After that the inner join will be very easy.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 02:00:51 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-06-07T02:00:51Z</dc:date>
    <item>
      <title>How to Extract just column headers from a table in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3977990#M154238</link>
      <description>&lt;P&gt;Basically, I have 2 identical tables. 1 table contains old product data and the other contains new product data.&lt;/P&gt;&lt;P&gt;The first column contains the products and has the header 'Products'. The other columns contain sales data by month and have headers such as '202201', '202202', '202203' etc all the way up to '202405'...&lt;/P&gt;&lt;P&gt;Although, the old data table month range is -1 compared to the new data table. So the 2 tables have a couple of monthly columns that do not match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I want to be able to extract the column headers from both tables, and create an inner join so that only MATCHING column names between the 2 tables are returned.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want this to be done using DAX ideally, as I need it to be an automated process each month, so that I dont have to go into PowerQuery and extract them manually every single month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next month, there will be new data and the current new data table will then be the old data table if that makes sense. So I need this to be an automated process so I dont have to do anything manually each month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone knows how I can achieve this, would be amazing. Thank you&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 20:56:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3977990#M154238</guid>
      <dc:creator>glyn1997</dc:creator>
      <dc:date>2024-06-06T20:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Extract just column headers from a table in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3978331#M154252</link>
      <description>&lt;P class="lia-align-left"&gt;The data structure is the opposite of what Power BI likes.&amp;nbsp; Your requirement cannot be fulfilled in DAX as there is no way in DAX to dynamically address columns of a table.&lt;/P&gt;
&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;You have to use Power Query to bring the data into a usable format by unpivoting the year columns.&amp;nbsp; After that the inner join will be very easy.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 02:00:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3978331#M154252</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-07T02:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Extract just column headers from a table in Power BI?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3997564#M155453</link>
      <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;, please allow me to complement the solutions you offer and offer additional insights:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;HI,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="756025" data-lia-user-login="glyn1997" class="lia-mention lia-mention-user"&gt;glyn1997&lt;/a&gt;&amp;nbsp; &lt;BR /&gt;May I ask whether the post from lbendlin solves your problem? If it does, please accept his post as the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are my additions to how to get column names:&lt;/P&gt;
&lt;P&gt;First I have created the following table and the column names and data are the data you have given:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;1.The first is the method lbendlin offers:&lt;BR /&gt;First select all the columns in the powerquery and then perform the reversal operation:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Next, use the "append query" for the two tables:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Finally, perform a deduplication operation in m language:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;distinct1=Table.Distinct(Source),
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.Another method:&lt;/P&gt;
&lt;P&gt;First you need to create two new queries with refrence and then in the two new tables, execute the following m language:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = new,
    names=Table.ColumnNames(Source),
    output1=Table.FromList(names,Splitter.SplitByNothing(),{"column name"})
in
    output1&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = old,
    names1=Table.ColumnNames(Source),
    output2=Table.FromList(names1,Splitter.SplitByNothing(),{"column name"})
in
    output2
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then click New Blank Query and enter the following m language in Advanced Editor:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
   combinee=Table.Combine({#"new (2)",#"old (2)"}),
   distinct1=Table.Distinct(combinee)
in
 distinct1
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.Here's my final result, which I hope meets your requirements.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;4.Here is the relevant documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powerquery-m/table-columnnames" target="_blank" rel="noopener"&gt;Table.ColumnNames - PowerQuery M | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powerquery-m/table-fromlist" target="_blank" rel="noopener"&gt;Table.FromList - PowerQuery M | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powerquery-m/table-distinct" target="_blank" rel="noopener"&gt;Table.Distinct - PowerQuery M | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Leroy Lu&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider Accept it &lt;STRONG&gt;&lt;EM&gt;as the solution &lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 06:25:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Extract-just-column-headers-from-a-table-in-Power-BI/m-p/3997564#M155453</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-18T06:25:27Z</dc:date>
    </item>
  </channel>
</rss>

