<?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 Headers and Case in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213606#M52304</link>
    <description>&lt;P&gt;Hello all,&lt;BR /&gt;&lt;BR /&gt;I have seen this question asked but the answer does not work for me so I am opening this probably very simple subject.&lt;BR /&gt;My database changed and all my tables now have lower case headers instead of previous upper case, which means my queries do not work on the new tables.&lt;BR /&gt;The headers I want to change are the headers of the database (not headers I manually promoted to headers), so the "transpose , upper case, then re transpose" solution does not work as the headers then disappear, and is not practical for me anyways.&lt;BR /&gt;&lt;BR /&gt;I would like to implement a function directly in advanced editor to do so(which I have never used before so maybe a syntax issue)&lt;BR /&gt;My base code after acquisition for the table is this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]in&lt;BR /&gt;public_Mytable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to apply the answer from:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Programmatically-change-the-case-of-headers-from-a-csv-file/m-p/239866" target="_blank"&gt;Solved: Programmatically change the case of headers (from ... - Microsoft Power BI Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;to make this :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source = #table(2,{{1,2}}),&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;in&lt;BR /&gt;public_Mytable&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Im guessing the issue is on the&amp;nbsp;Source = #table(2,{{1,2}}),&amp;nbsp; &amp;nbsp;which I have copied litterally from the answer and probably does not apply as is, but i cant find syntax explanation in order to solve this.&lt;BR /&gt;I know its a small thing but i would appreciate explanation on syntax + solution to my problem&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Nov 2021 09:27:31 GMT</pubDate>
    <dc:creator>Zalexatwork</dc:creator>
    <dc:date>2021-11-30T09:27:31Z</dc:date>
    <item>
      <title>Headers and Case</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213606#M52304</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;&lt;BR /&gt;I have seen this question asked but the answer does not work for me so I am opening this probably very simple subject.&lt;BR /&gt;My database changed and all my tables now have lower case headers instead of previous upper case, which means my queries do not work on the new tables.&lt;BR /&gt;The headers I want to change are the headers of the database (not headers I manually promoted to headers), so the "transpose , upper case, then re transpose" solution does not work as the headers then disappear, and is not practical for me anyways.&lt;BR /&gt;&lt;BR /&gt;I would like to implement a function directly in advanced editor to do so(which I have never used before so maybe a syntax issue)&lt;BR /&gt;My base code after acquisition for the table is this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]in&lt;BR /&gt;public_Mytable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to apply the answer from:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Programmatically-change-the-case-of-headers-from-a-csv-file/m-p/239866" target="_blank"&gt;Solved: Programmatically change the case of headers (from ... - Microsoft Power BI Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;to make this :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source = #table(2,{{1,2}}),&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;in&lt;BR /&gt;public_Mytable&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Im guessing the issue is on the&amp;nbsp;Source = #table(2,{{1,2}}),&amp;nbsp; &amp;nbsp;which I have copied litterally from the answer and probably does not apply as is, but i cant find syntax explanation in order to solve this.&lt;BR /&gt;I know its a small thing but i would appreciate explanation on syntax + solution to my problem&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 09:27:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213606#M52304</guid>
      <dc:creator>Zalexatwork</dc:creator>
      <dc:date>2021-11-30T09:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Headers and Case</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213938#M52322</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318989" data-lia-user-login="Zalexatwork" class="lia-mention lia-mention-user"&gt;Zalexatwork&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would say the code you need is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
  Source           = PostgreSQL.Database("Servername", "datasourcename"),
  public_Mytable   = Source{[Schema = "public", Item = "Mytable"]}[Data],
  HeadersUpperCase = Table.TransformColumnNames(public_Mytable, Text.Upper)
in
  HeadersUpperCase&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The HeadersUpperCase step needs to reference the step that produced the original table, i.e. &lt;STRONG&gt;public_Mytable&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;And after the final "in", you should reference the step name that produced the result you want to return, i.e. &lt;STRONG&gt;HeadersUpperCase.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Oh and that #table(...) step wasn't needed, as you suspected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully that works!&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 11:57:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213938#M52322</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-11-30T11:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Headers and Case</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213984#M52328</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thanks Owen, it worked.&lt;BR /&gt;As suspected it was primarily a syntax issue. So if i understand correctly:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
  Source           = PostgreSQL.Database("Servername", "datasourcename"),
  public_Mytable   = Source{[Schema = "public", Item = "Mytable"]}[Data],
  HeadersUpperCase = Table.TransformColumnNames(public_Mytable, Text.Upper)
in
  HeadersUpperCase&lt;/LI-CODE&gt;&lt;P&gt;Line 1, 2 and 3 allow for the program to understand the source to which i want to apply my query&lt;BR /&gt;line 4 is the function I apply&lt;/P&gt;&lt;P&gt;line 5 lets it understand that this function should be created in a new step called 'headersuppercase'&lt;BR /&gt;&lt;BR /&gt;So were I to apply a new function I would either do this :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)&lt;BR /&gt;FUNCTION 2 = Table.Function(arguments)&lt;/P&gt;&lt;P&gt;in HeadersUpperCase&lt;BR /&gt;&lt;BR /&gt;to get upper case AND function 2 applied in the Headersuppercase step, or :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)&lt;/P&gt;&lt;P&gt;in HeadersUpperCase&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&amp;nbsp; &amp;nbsp;&lt;BR /&gt;FUNCTION 2 = Table.Function(arguments)&lt;BR /&gt;in Function2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To have two functions applied on the same table in two different steps,&lt;BR /&gt;Im guessing below would give the same result:&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = PostgreSQL.Database("Servername", "datasourcename"),&lt;BR /&gt;public_Mytable = Source{[Schema="public",Item="Mytable"]}[Data]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)&lt;/P&gt;&lt;P&gt;in HeadersUpperCase&lt;BR /&gt;FUNCTION 2 = Table.Function(arguments)&lt;BR /&gt;in Function2&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 12:21:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2213984#M52328</guid>
      <dc:creator>Zalexatwork</dc:creator>
      <dc:date>2021-11-30T12:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Headers and Case</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2214882#M52388</link>
      <description>&lt;P&gt;You're welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I think the easiest way to describe the structure of the M code for a typical query is:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" size="2"&gt;let&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp;&amp;lt;List of variable definitions (comma-separated), that can refer to each other&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp;&amp;lt;Variable containing the result to return&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically the list of variables after &lt;STRONG&gt;let&lt;/STRONG&gt; represent "steps" in a sequence (especially if generated by the UI), so each will reference the previous one. You will see this list in the Applied Steps panel on the right of the Power Query editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a slight correction to your code where you applied an additional function, and colour-coded the step names to show how each step references the previous one:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 21:41:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2214882#M52388</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-11-30T21:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Headers and Case</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2215639#M52438</link>
      <description>&lt;P&gt;Very helpful and very clear. I worked with an example with a few generated steps and it makes a lot of sense. Just very different from the VBA structure Im used to.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 08:11:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Headers-and-Case/m-p/2215639#M52438</guid>
      <dc:creator>Zalexatwork</dc:creator>
      <dc:date>2021-12-01T08:11:44Z</dc:date>
    </item>
  </channel>
</rss>

