<?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 Total not visible in Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4069853#M161581</link>
    <description>&lt;P class="lia-align-left"&gt;Hi everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a issue, where values are shown on row level but not at the total level.&lt;BR /&gt;&lt;BR /&gt;Logic for the calculation has to be as followed:&lt;BR /&gt;1. We have to check Billings for the previous month when the Net Billings was not 0, then I have to sum Cost after that period when Net Billings is not 0.&lt;BR /&gt;2. If there no record where the Net Billings is not 0 then sum all the Cost.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Cost =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    CALCULATE(
        SUM('Project Actuals'[Internal_Costs]),
        USERELATIONSHIP('Project Actuals'[Date],'Rev Rec'[Date]))​&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;li-code lang="markup"&amp;gt;Billings = SUM('Rev Rec'[Net Billings])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is the DAX which I have tried, but it's not giving me total.&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;Final Cost = 

VAR _currentmonth = SELECTEDVALUE('Rev Rec'[Date])
VAR _lastNonZeroDate = 
    CALCULATE(
        LASTDATE('Rev Rec'[Date]),
        FILTER(
            ALL('Rev Rec'[Date]),
            'Rev Rec'[Date] &amp;lt; _currentmonth &amp;amp;&amp;amp; [Net Billings] &amp;lt;&amp;gt; 0
        )
    )
VAR _earliestDate = 
    CALCULATE(
        MIN('Rev Rec'[Date]),
        FILTER(
            ALL('Rev Rec'[Date]),
            [Net Billings] = 0
        )
    )
RETURN 

    IF(
        ISBLANK(_lastNonZeroDate), 
        CALCULATE(
            [Internal Cost], 
            'Rev Rec'[Date] &amp;gt;= _earliestDate &amp;amp;&amp;amp; 'Rev Rec'[Date] &amp;lt; _currentmonth),
            IF(
                _lastNonZeroDate &amp;lt;&amp;gt; BLANK(), 

                CALCULATE(
                    [Internal Cost],
                    FILTER(ALL('Rev Rec'[Date]),
                    'Rev Rec'[Date] &amp;gt; _lastNonZeroDate &amp;amp;&amp;amp; 'Rev Rec'[Date] &amp;lt; _currentmonth))Below image shows, the first scenario when we have a Value in Net Billings, so in this case I need sum after that period.&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Second Scenario, when there is no values for previous months in Net Billings, then we have to sum everything in Cost.&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would appreciate your help, and if there are any better solution for this.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Nik&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 30 Jul 2024 19:42:38 GMT</pubDate>
    <dc:creator>nikkr38</dc:creator>
    <dc:date>2024-07-30T19:42:38Z</dc:date>
    <item>
      <title>Total not visible in Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4069853#M161581</link>
      <description>&lt;P class="lia-align-left"&gt;Hi everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a issue, where values are shown on row level but not at the total level.&lt;BR /&gt;&lt;BR /&gt;Logic for the calculation has to be as followed:&lt;BR /&gt;1. We have to check Billings for the previous month when the Net Billings was not 0, then I have to sum Cost after that period when Net Billings is not 0.&lt;BR /&gt;2. If there no record where the Net Billings is not 0 then sum all the Cost.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Cost =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    CALCULATE(
        SUM('Project Actuals'[Internal_Costs]),
        USERELATIONSHIP('Project Actuals'[Date],'Rev Rec'[Date]))​&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;/p&amp;gt;&amp;lt;p&amp;gt; &amp;lt;li-code lang="markup"&amp;gt;Billings = SUM('Rev Rec'[Net Billings])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is the DAX which I have tried, but it's not giving me total.&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;Final Cost = 

VAR _currentmonth = SELECTEDVALUE('Rev Rec'[Date])
VAR _lastNonZeroDate = 
    CALCULATE(
        LASTDATE('Rev Rec'[Date]),
        FILTER(
            ALL('Rev Rec'[Date]),
            'Rev Rec'[Date] &amp;lt; _currentmonth &amp;amp;&amp;amp; [Net Billings] &amp;lt;&amp;gt; 0
        )
    )
VAR _earliestDate = 
    CALCULATE(
        MIN('Rev Rec'[Date]),
        FILTER(
            ALL('Rev Rec'[Date]),
            [Net Billings] = 0
        )
    )
RETURN 

    IF(
        ISBLANK(_lastNonZeroDate), 
        CALCULATE(
            [Internal Cost], 
            'Rev Rec'[Date] &amp;gt;= _earliestDate &amp;amp;&amp;amp; 'Rev Rec'[Date] &amp;lt; _currentmonth),
            IF(
                _lastNonZeroDate &amp;lt;&amp;gt; BLANK(), 

                CALCULATE(
                    [Internal Cost],
                    FILTER(ALL('Rev Rec'[Date]),
                    'Rev Rec'[Date] &amp;gt; _lastNonZeroDate &amp;amp;&amp;amp; 'Rev Rec'[Date] &amp;lt; _currentmonth))Below image shows, the first scenario when we have a Value in Net Billings, so in this case I need sum after that period.&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Second Scenario, when there is no values for previous months in Net Billings, then we have to sum everything in Cost.&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would appreciate your help, and if there are any better solution for this.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Nik&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Jul 2024 19:42:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4069853#M161581</guid>
      <dc:creator>nikkr38</dc:creator>
      <dc:date>2024-07-30T19:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Total not visible in Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4070251#M161590</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="783221" data-lia-user-login="nikkr38" class="lia-mention lia-mention-user"&gt;nikkr38&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _maxdate=
MAXX(
    ALLSELECTED('Table'),'Table'[Date])
var _value=
SUMX(
    FILTER(ALLSELECTED('Table'),'Table'[Date]=_maxdate),[Net Billings])
RETURN
IF(
    _value&amp;lt;&amp;gt;0&amp;amp;&amp;amp;HASONEFILTER('Table'[Date]),SUM('Table'[Internal Cost]),
    SUMX(
       FILTER( ALLSELECTED('Table'),[Net Billings]&amp;lt;&amp;gt;0),[Internal Cost]))&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&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;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 02:42:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4070251#M161590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-31T02:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Total not visible in Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4072195#M161671</link>
      <description>&lt;P&gt;Hey&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I appreciate your efforts in solving this problem, but the soltuion is not correct.&lt;BR /&gt;I need only the sum of cost, after the most recent date when there was a value in Billings &amp;amp; if there is no value in billings for previous month then I need sum of all the internal cost.&lt;BR /&gt;&lt;BR /&gt;FYI : Date has to be most recent when there was a value in Billing for previous months.&lt;BR /&gt;&lt;BR /&gt;Let me know if you need, more info.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Nik&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 22:25:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-not-visible-in-Table/m-p/4072195#M161671</guid>
      <dc:creator>nikkr38</dc:creator>
      <dc:date>2024-07-31T22:25:43Z</dc:date>
    </item>
  </channel>
</rss>

