<?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: Dynamic column generation using DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064896#M161371</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="781200" data-lia-user-login="Gaga_Jin" class="lia-mention lia-mention-user"&gt;Gaga_Jin&lt;/a&gt;&amp;nbsp;There are an array of issues with that formula. First, [Code] will not be recognized 5 lines up from the bottom. The reason is that you are trying to refer to a column that you are adding while you are adding it which won't work. You would need 2 ADDCOLUMNS if you wanted to reference [Code]. Second, you will get an error stating that "Multiple columns cannot be convereted to a scalar" or something along those lines because you are trying to fit 2 columns of data into a single column. Third, even if none of that was a problem ( and it is ), you would still not arrive at the desired table, you would have a column called Code and a column called TotalHours which isn't what is desired.&lt;/P&gt;</description>
    <pubDate>Sat, 27 Jul 2024 10:57:26 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2024-07-27T10:57:26Z</dc:date>
    <item>
      <title>Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064285#M161351</link>
      <description>&lt;P&gt;PROFSUMMARY =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;Hi,&lt;BR /&gt;Training,&lt;BR /&gt;Training[ID],&lt;BR /&gt;Training[Prof],&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP101", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP101",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP103", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP103",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP102", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP102",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP320", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP320",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;)&lt;BR /&gt;How can be this red section generate dynamically based on the available distinct code in Training[Code].&lt;BR /&gt;can someone help me to achive this??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 18:12:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064285#M161351</guid>
      <dc:creator>axiosfabric</dc:creator>
      <dc:date>2024-07-26T18:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064287#M161353</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681394" data-lia-user-login="axiosfabric" class="lia-mention lia-mention-user"&gt;axiosfabric&lt;/a&gt;&amp;nbsp;Not really understanding this at all. Can you post sample data and expected output?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 18:12:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064287#M161353</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-07-26T18:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064301#M161355</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Training&amp;nbsp;&lt;/SPAN&gt;=&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Prof&lt;/TD&gt;&lt;TD&gt;Code&lt;/TD&gt;&lt;TD&gt;hrs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 1&lt;/TD&gt;&lt;TD&gt;DP101&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 2&lt;/TD&gt;&lt;TD&gt;DP103&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 3&lt;/TD&gt;&lt;TD&gt;DP102&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 4&lt;/TD&gt;&lt;TD&gt;DP320&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 1&lt;/TD&gt;&lt;TD&gt;DP320&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Expected table result&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Prof&lt;/TD&gt;&lt;TD&gt;DP101&lt;/TD&gt;&lt;TD&gt;DP103&lt;/TD&gt;&lt;TD&gt;DP102&lt;/TD&gt;&lt;TD&gt;DP320&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;User 4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;based on this below code I can achive the above format&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;PROFSUMMARY =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUMMARIZE (&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Training,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Training[ID],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Training[Prof],&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP101", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP101",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP103", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP103",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP102", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP102",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP320", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP320",Training[Mode] = "Virtual" ),&lt;/FONT&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;but here I need to mention the&amp;nbsp;&lt;FONT color="#993366"&gt;"DP101" as hard coded&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993366"&gt;"DP101", CALCULATE ( SUM ( Training[Att Hrs] ), Training[Code] = "DP101",Training[Mode] = "Virtual" ),&lt;BR /&gt;&lt;/FONT&gt;I need to generate this section dynamically based on the the distinct code availble&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 18:24:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064301#M161355</guid>
      <dc:creator>axiosfabric</dc:creator>
      <dc:date>2024-07-26T18:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064866#M161370</link>
      <description>&lt;P&gt;1.&amp;nbsp;&lt;STRONG&gt;Create a separate table for distinct codes&lt;/STRONG&gt;:&lt;BR /&gt;DistinctCodes = DISTINCT(Training[Code])&lt;BR /&gt;2.&amp;nbsp;&lt;STRONG&gt;Create a calculated table to summarize the data dynamically&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;PROFSUMMARY =&lt;BR /&gt;VAR DistinctCodes = DISTINCT(Training[Code])&lt;BR /&gt;RETURN&lt;BR /&gt;ADDCOLUMNS(&lt;BR /&gt;SUMMARIZE(&lt;BR /&gt;Training,&lt;BR /&gt;Training[ID],&lt;BR /&gt;Training[Prof]&lt;BR /&gt;),&lt;BR /&gt;"DynamicColumns",&lt;BR /&gt;SELECTCOLUMNS(&lt;BR /&gt;DistinctCodes,&lt;BR /&gt;"Code", [Code],&lt;BR /&gt;"TotalHours",&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(Training[Att Hrs]),&lt;BR /&gt;Training[Code] = [Code],&lt;BR /&gt;Training[Mode] = "Virtual"&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2024 10:16:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064866#M161370</guid>
      <dc:creator>Gaga_Jin</dc:creator>
      <dc:date>2024-07-27T10:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064896#M161371</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="781200" data-lia-user-login="Gaga_Jin" class="lia-mention lia-mention-user"&gt;Gaga_Jin&lt;/a&gt;&amp;nbsp;There are an array of issues with that formula. First, [Code] will not be recognized 5 lines up from the bottom. The reason is that you are trying to refer to a column that you are adding while you are adding it which won't work. You would need 2 ADDCOLUMNS if you wanted to reference [Code]. Second, you will get an error stating that "Multiple columns cannot be convereted to a scalar" or something along those lines because you are trying to fit 2 columns of data into a single column. Third, even if none of that was a problem ( and it is ), you would still not arrive at the desired table, you would have a column called Code and a column called TotalHours which isn't what is desired.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2024 10:57:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4064896#M161371</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-07-27T10:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4066044#M161413</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681394" data-lia-user-login="axiosfabric" class="lia-mention lia-mention-user"&gt;axiosfabric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try to use the &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;Pivot Column&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; feature in the power query:&lt;/P&gt;
&lt;P&gt;Open the Power query, select the code column and click the pivot column in the transform pane:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then Select Hrs in the Value Column box and select Sum in Aggregaet Value Function box:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Click Close &amp;amp; Apply:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;The result is as follow:&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;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 03:00:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4066044#M161413</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-29T03:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column generation using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4066556#M161432</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681394" data-lia-user-login="axiosfabric" class="lia-mention lia-mention-user"&gt;axiosfabric&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Source data&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Taking a Matrix Visualization and turning off column/row subtotals&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if this solves your problem then please accept the same as your solution.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 08:21:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-column-generation-using-DAX/m-p/4066556#M161432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-29T08:21:56Z</dc:date>
    </item>
  </channel>
</rss>

