title: Text.Trim Syntax Meaning
body: <p>I'm working in a Power BI query, trying to trim whitespace from text. </p>
  
  <p>Looking at Microsoft's M reference, I came across the <code>Text.Trim</code> syntax:</p>
  
  <pre><code>Text.Trim(text as nullable text, optional trimChars as any) as nullable text  
  </code></pre>
  
  <p>I couldn't figure out how to plug it into my query code correctly (where it would actually work) so I did some more searching and came across this:</p>
  
  <pre><code>#"Trimmed Text" = Table.TransformColumns(#"Removed Other Columns",{},Text.Trim),
  </code></pre>
  
  <p>...which doesn't look anything like Microsoft's syntax but works fine for me as I insert it into my code like this:</p>
  
  <pre><code>let
      Source = Banding,
      #"Removed Other Columns" = Table.SelectColumns(Source,{"Segment", "Granular Band"}),
      #"Trimmed Text" = Table.TransformColumns(#"Removed Other Columns",{},Text.Trim),
      #"Removed Duplicates" = Table.Distinct(#"Trimmed Text", {"Granular Band"})
  in
      #"Removed Duplicates"
  </code></pre>
  
  <p>My problem is that I don't understand what the line's syntax <em>meaning</em> is. I understood Microsoft's example as meaning basically, trim THIS; where THIS is the text I want trimmed. Pretty straightforward.</p>
  
  <p>But I don't know what the syntax meaning of the line that actually works is. I understand that it says to transform table columns (<code>Table.TransformColumns</code>); but I don't know if the reference to the previous line (<code>#"Removed Other Columns"</code>) serves as any real "input" for the <code>Text.Trim</code> or if <code>{}</code> is a reference to all columns in the table, or (more importantly to me) how I would reference specific columns. (I've tried a few approaches for specifying columns and failed every time.) I also don't understand why I don't need any arguments following <code>Text.Trim</code> (like in Microsoft's example). </p>
  
  <p>If someone would translate what the line is "saying" in a manner I can understand, I'd sure appreciate it.</p>