<?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 Calculated table with additional calculated column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4122028#M163666</link>
    <description>&lt;P&gt;Dear Group,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a table that will be based on Union as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Ranking = &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Var _Plant1 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant1"))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var _summary = ADDCOLUMNS(_Plant1,"Rank",RANKX(ALL(_Plant1),_Plant1[Sum of act],,DESC,Dense))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Var _Plant2 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant2"))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var _summary2 = ADDCOLUMNS(_Plant2,"Rank",RANKX(ALL(_Plant2),_Plant2[Sum of act],,DESC,Dense))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RETURN union(_summary,_summary2)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Unfortunately, this doesn't work. It works if I do it step by step - first create a separate table per plant, then add a column with ranking and then create a separate table with UNION, but as I have 10 plants, I would like to avoid creation of 11 tables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The overall idea is to give rank to per customer per plant based on sum of actuals.&lt;BR /&gt;&lt;BR /&gt;Could you please advise how to do it all at one? Thank you in advance.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 28 Aug 2024 06:21:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-28T06:21:50Z</dc:date>
    <item>
      <title>Calculated table with additional calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4122028#M163666</link>
      <description>&lt;P&gt;Dear Group,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a table that will be based on Union as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Ranking = &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Var _Plant1 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant1"))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var _summary = ADDCOLUMNS(_Plant1,"Rank",RANKX(ALL(_Plant1),_Plant1[Sum of act],,DESC,Dense))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Var _Plant2 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant2"))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var _summary2 = ADDCOLUMNS(_Plant2,"Rank",RANKX(ALL(_Plant2),_Plant2[Sum of act],,DESC,Dense))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RETURN union(_summary,_summary2)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Unfortunately, this doesn't work. It works if I do it step by step - first create a separate table per plant, then add a column with ranking and then create a separate table with UNION, but as I have 10 plants, I would like to avoid creation of 11 tables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The overall idea is to give rank to per customer per plant based on sum of actuals.&lt;BR /&gt;&lt;BR /&gt;Could you please advise how to do it all at one? Thank you in advance.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Aug 2024 06:21:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4122028#M163666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-28T06:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated table with additional calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4122060#M163668</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, Without creating multiple intermediate tables, you can use a single DAX expression that combines the steps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ranking =&lt;BR /&gt;VAR _AllPlants = &lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;SUMMARIZE(&lt;BR /&gt;'For Plants',&lt;BR /&gt;'For Plants'[Customer],&lt;BR /&gt;'For Plants'[Plant abb],&lt;BR /&gt;"Sum of act", SUM('For Plants'[Actuals in LC])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;VAR _RankedPlants = &lt;BR /&gt;ADDCOLUMNS(&lt;BR /&gt;_AllPlants,&lt;BR /&gt;"Rank", RANKX(&lt;BR /&gt;FILTER(_AllPlants, 'For Plants'[Plant abb] = EARLIER('For Plants'[Plant abb])),&lt;BR /&gt;[Sum of act],&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;RETURN _RankedPlants&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 06:39:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4122060#M163668</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-08-28T06:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated table with additional calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4123830#M163752</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created test data and tested the formula provided by &lt;STRONG&gt;bhanu_gautam&lt;/STRONG&gt;&amp;nbsp;and the results should meet your needs.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ranking = 
VAR _AllPlants = 
    SUMMARIZE(
        'For Plants',
        'For Plants'[Customer],
        'For Plants'[Plant abb],
        "Sum of act", SUM('For Plants'[Actuals in LC])
    )
VAR _RankedPlants = 
    ADDCOLUMNS(
        _AllPlants,
        "Rank", RANKX(
            FILTER(_AllPlants, [Plant abb] = EARLIER([Plant abb])),
            [Sum of act],
            ,
            DESC,
            DENSE
        )
    )
RETURN _RankedPlants&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 01:55:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-table-with-additional-calculated-column/m-p/4123830#M163752</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-29T01:55:15Z</dc:date>
    </item>
  </channel>
</rss>

