<?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: Converting Columns to Rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486717#M68309</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="384782" data-lia-user-login="ahjamil" class="lia-mention lia-mention-user"&gt;ahjamil&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power Query is a fantastic tool to unpivot columns and solve this issue:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) You first need to create a duplicate of your table. Right click on the table in the query list on the left and click duplicate.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Right click on the Group column and choose unpviot other columns:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Double click on the name of the column (Attribute) and rename it to Month:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the whole M code that you can use in the advanced editor:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjdU0lEyNIARlkqxOkBBIxAfLGMCYYFFjeFKwfLGEFETuIAhhAUWNYUJWEI0xcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Group = _t, Jan = _t, Feb = _t, Mar = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Jan", Int64.Type}, {"Feb", Int64.Type}, {"Mar", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Group"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Month"}})
in
    #"Renamed Columns"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Apr 2022 06:32:02 GMT</pubDate>
    <dc:creator>tackytechtom</dc:creator>
    <dc:date>2022-04-30T06:32:02Z</dc:date>
    <item>
      <title>Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486572#M68306</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I need help converting columns to a single column. I have following Table:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;Jan&lt;/TD&gt;&lt;TD&gt;Feb&lt;/TD&gt;&lt;TD&gt;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Mar&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I need this to create a WaterFall Chart that can provide user a selection of months.&amp;nbsp;Please help with a solution.&lt;BR /&gt;Thanks in anticipation.&lt;BR /&gt;&lt;BR /&gt;Ahmad&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 23:44:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486572#M68306</guid>
      <dc:creator>ahjamil</dc:creator>
      <dc:date>2022-04-29T23:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486717#M68309</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="384782" data-lia-user-login="ahjamil" class="lia-mention lia-mention-user"&gt;ahjamil&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power Query is a fantastic tool to unpivot columns and solve this issue:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) You first need to create a duplicate of your table. Right click on the table in the query list on the left and click duplicate.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Right click on the Group column and choose unpviot other columns:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Double click on the name of the column (Attribute) and rename it to Month:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the whole M code that you can use in the advanced editor:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjdU0lEyNIARlkqxOkBBIxAfLGMCYYFFjeFKwfLGEFETuIAhhAUWNYUJWEI0xcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Group = _t, Jan = _t, Feb = _t, Mar = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Jan", Int64.Type}, {"Feb", Int64.Type}, {"Mar", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Group"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Month"}})
in
    #"Renamed Columns"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 06:32:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486717#M68309</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-04-30T06:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486719#M68310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If you can go into Power Query Editor, please select a Group Column, and click Transform tab -&amp;gt; Unpivot Other Columns button.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 06:34:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486719#M68310</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-04-30T06:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486726#M68311</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="384782" data-lia-user-login="ahjamil" class="lia-mention lia-mention-user"&gt;ahjamil&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you asked here in the DAX Commands and Tips forum, here a possible solution in DAX. Note, if you have the possibility to do it in Power Query, I'd recommend to do it there since the DAX code is not very sunstainable. For instance, next time a new month is added to your table (i.e. April) you need to rewrite the code...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX:&lt;/P&gt;&lt;PRE&gt;Table = 
UNION ( 
    SELECTCOLUMNS(Table, "Group", Table[Group], "Month", "Jan", "Value", Table[Jan] ),
    SELECTCOLUMNS(Table, "Group", Table[Group], "Month", "Feb", "Value", Table[Feb] ),
    SELECTCOLUMNS(Table, "Group", Table[Group], "Month", "Mar", "Value", Table[Mar] )
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 07:07:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486726#M68311</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-04-30T07:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486817#M68318</link>
      <description>&lt;P&gt;This was extremely helpful Tom.&lt;BR /&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 10:44:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486817#M68318</guid>
      <dc:creator>ahjamil</dc:creator>
      <dc:date>2022-04-30T10:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Columns to Rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486818#M68319</link>
      <description>&lt;P&gt;Hi Tom,&amp;nbsp;&lt;BR /&gt;Thank you for explaining the Power Query solution as well. I have a question that I get additional data in this table monthly, so would the Power Query table refresh data whenever I will refresh the report?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 10:47:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Converting-Columns-to-Rows/m-p/2486818#M68319</guid>
      <dc:creator>ahjamil</dc:creator>
      <dc:date>2022-04-30T10:47:16Z</dc:date>
    </item>
  </channel>
</rss>

