<?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 DAX Virtual tables &amp;amp; total row evaluation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Virtual-tables-amp-total-row-evaluation/m-p/1860778#M39864</link>
    <description>&lt;P&gt;Is it possible to create a virtual table which returns a different measure for each row based on some logic……….and then expect SUMX to produced the desired result in the total row?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a dummy .pbix of the scenario required in full (mimicking coding and source systems from real data). Presenting it as a DAX problem, but could well be a data modelling answer!&lt;/P&gt;&lt;P&gt;&lt;A href="https://nspccppschools-my.sharepoint.com/:u:/g/personal/patrick_mcmonagle_nspcc_org_uk/ETSpUuefdcFHnCEixU6MbOgBmau4Rx8PlGumqK4Q6ZydmA?e=vnRJ1w" target="_self"&gt;Dummy pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;Require a solution to view Income in the view of a Corporate partner to a Charity, where applicable, if not just view it as an individual supporter. Scenario is that Microsoft could give a donation from Head Office, their UK office or an employee could run a race for them. So the standard view would be income per those three Supporter records. However also want to see the view of Microsoft as a whole entity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to be OK, but then add another individual who is not coded to raised for Microsoft and the current measure doesn’t evaluate correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 May 2021 17:13:06 GMT</pubDate>
    <dc:creator>pmcmonag</dc:creator>
    <dc:date>2021-05-24T17:13:06Z</dc:date>
    <item>
      <title>DAX Virtual tables &amp; total row evaluation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Virtual-tables-amp-total-row-evaluation/m-p/1860778#M39864</link>
      <description>&lt;P&gt;Is it possible to create a virtual table which returns a different measure for each row based on some logic……….and then expect SUMX to produced the desired result in the total row?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a dummy .pbix of the scenario required in full (mimicking coding and source systems from real data). Presenting it as a DAX problem, but could well be a data modelling answer!&lt;/P&gt;&lt;P&gt;&lt;A href="https://nspccppschools-my.sharepoint.com/:u:/g/personal/patrick_mcmonagle_nspcc_org_uk/ETSpUuefdcFHnCEixU6MbOgBmau4Rx8PlGumqK4Q6ZydmA?e=vnRJ1w" target="_self"&gt;Dummy pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;Require a solution to view Income in the view of a Corporate partner to a Charity, where applicable, if not just view it as an individual supporter. Scenario is that Microsoft could give a donation from Head Office, their UK office or an employee could run a race for them. So the standard view would be income per those three Supporter records. However also want to see the view of Microsoft as a whole entity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to be OK, but then add another individual who is not coded to raised for Microsoft and the current measure doesn’t evaluate correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 17:13:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Virtual-tables-amp-total-row-evaluation/m-p/1860778#M39864</guid>
      <dc:creator>pmcmonag</dc:creator>
      <dc:date>2021-05-24T17:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Virtual tables &amp; total row evaluation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Virtual-tables-amp-total-row-evaluation/m-p/1860895#M39865</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="97252" data-lia-user-login="pmcmonag" class="lia-mention lia-mention-user"&gt;pmcmonag&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to trigger &lt;STRONG&gt;context transition&lt;/STRONG&gt; for it to work propertly (so that the COUNTROWS takes into account what you have in the row of the visual)&amp;nbsp; . Just add a CALCULATE:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Income (Dynamic) V2 =
VAR TempTable =
    ADDCOLUMNS (
        VALUES ( Supporters[SupporterID] ),
        "Income",
            IF (
                CALCULATE ( COUNTROWS ( 'Corporate Finance Codes' ) ) &amp;gt; 0,
                [Total Income (by Corporate)],
                [Total Income]
            )
    )
RETURN
    SUMX ( TempTable, [Income] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR alternatively, a version a bit more compact:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Income (Dynamic) V3 =
SUMX (
    DISTINCT ( Supporters[SupporterID] ),
    IF (
        CALCULATE ( COUNTROWS ( 'Corporate Finance Codes' ) ) &amp;gt; 0,
        [Total Income (by Corporate)],
        [Total Income]
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 19:08:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Virtual-tables-amp-total-row-evaluation/m-p/1860895#M39865</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2021-05-24T19:08:31Z</dc:date>
    </item>
  </channel>
</rss>

