<?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: Calculated Column on a temp table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1704859#M35141</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="245823" data-lia-user-login="JPScotland" class="lia-mention lia-mention-user"&gt;JPScotland&lt;/a&gt; , No very clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;averageX(Values('Servitor Repairs General'[Week Starting]), CALCULATE ( DISTINCTCOUNT ('Servitor Repairs General'[Job Number as integer])))&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 07:56:55 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-03-05T07:56:55Z</dc:date>
    <item>
      <title>Calculated Column on a temp table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1703842#M35094</link>
      <description>&lt;P&gt;I have a table that has a list of repairs that we receive everyday.&amp;nbsp; "El jefe" likes to see the data on a weekly basis so I have a column called "Week Starting Date", that I can use to split out the date.&amp;nbsp; But I am trying to calculate a weeklay average to show alongside the actual in a line graph.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Week Starting Date&lt;/TD&gt;&lt;TD&gt;NumberofRepairs&lt;/TD&gt;&lt;TD&gt;AverageNoOfRepairs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25/01/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;374&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;518&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;08/02/2021&lt;/TD&gt;&lt;TD&gt;516&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/02/2021&lt;/TD&gt;&lt;TD&gt;541&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22/02/2021&lt;/TD&gt;&lt;TD&gt;370&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have but I just can't seem to get the average column to work . Basically I'd like it to run with the weeks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table = 
        ADDCOLUMNS (
                       SUMMARIZE ( 
                               'Servitor Repairs General',
                                'Date'[Week Starting Date]),
                                "NumberofRepairs", CALCULATE ( DISTINCTCOUNT ('Servitor Repairs General'[Job Number as integer])),
                                "AverageNoOfRepairs", AVERAGEX ( FILTER (
                                                            ALLSELECTED ('Servitor Repairs General'),
                                                                            'Servitor Repairs General'[Week Starting Date] &amp;lt;= MAX ( 'Servitor Repairs General'[Week Starting Date]) ), 
                                                                                CALCULATE (DISTINCTCOUNT('Servitor Repairs General'[Job Number as integer]))
                                )
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;JP&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 17:16:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1703842#M35094</guid>
      <dc:creator>JPScotland</dc:creator>
      <dc:date>2021-03-04T17:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column on a temp table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1704859#M35141</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="245823" data-lia-user-login="JPScotland" class="lia-mention lia-mention-user"&gt;JPScotland&lt;/a&gt; , No very clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;averageX(Values('Servitor Repairs General'[Week Starting]), CALCULATE ( DISTINCTCOUNT ('Servitor Repairs General'[Job Number as integer])))&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 07:56:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1704859#M35141</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-03-05T07:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column on a temp table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1704886#M35143</link>
      <description>&lt;P&gt;Hi amitchandak,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&amp;nbsp; I gave that formula a go but it calculated the same figure as the repairs and not a running weekly average.&amp;nbsp; see below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;DIV class="lia-message-author-with-avatar"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Week Starting Date&lt;/TD&gt;&lt;TD&gt;NumberofRepairs&lt;/TD&gt;&lt;TD&gt;AverageNoOfRepairs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25/01/2021&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;374&lt;/TD&gt;&lt;TD&gt;374&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;518&lt;/TD&gt;&lt;TD&gt;518&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;08/02/2021&lt;/TD&gt;&lt;TD&gt;516&lt;/TD&gt;&lt;TD&gt;516&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/02/2021&lt;/TD&gt;&lt;TD&gt;541&lt;/TD&gt;&lt;TD&gt;541&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22/02/2021&lt;/TD&gt;&lt;TD&gt;370&lt;/TD&gt;&lt;TD&gt;370&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 08:10:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1704886#M35143</guid>
      <dc:creator>JPScotland</dc:creator>
      <dc:date>2021-03-05T08:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column on a temp table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1711319#M35315</link>
      <description>&lt;P class="lia-align-left"&gt;This is what I did but there is perhaps a better way.&amp;nbsp; I first created a summarized table then I did the calculation based on that: -&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_CalcTable Weekly Repairs = 

VAR _ALTTABLE = 
        ADDCOLUMNS (
                       SUMMARIZE ( 
                               'Repairs General',
                                'Date'[Week Starting Date]),
                                "No of Repairs", CALCULATE (DISTINCTCOUNT ('Repairs General'[Job Number as integer]))
        )
RETURN 
    _ALTTABLE&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a calcualtion based on that table: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average Weekly No of Repairs = 
//This uses the calculated table CalcTable Weekly Repairs to work out the average
 
    AVERAGEX (
                FILTER( 
                        ALLSELECTED(
                                    '_CalcTable Weekly Repairs'),   
                                    '_CalcTable Weekly Repairs'[Week Starting Date] &amp;lt;= MAX ('_CalcTable Weekly Repairs'[Week Starting Date])), 
            '_CalcTable Weekly Repairs'[No of Repairs]
    )&amp;lt;div&amp;gt; &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 11:05:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-on-a-temp-table/m-p/1711319#M35315</guid>
      <dc:creator>JPScotland</dc:creator>
      <dc:date>2021-03-09T11:05:17Z</dc:date>
    </item>
  </channel>
</rss>

