<?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 Summarize data under conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3426005#M129780</link>
    <description>&lt;P&gt;Hi Guys.&lt;/P&gt;&lt;P&gt;I have a sales table with product categories and a calendar table.&lt;/P&gt;&lt;P&gt;I use the below measures to calculate the Sales YTD and LYTD&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales YTD = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; , &lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Instead of : Sales LYTD = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales] , &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date])) , i use:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales LYTD = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales YTD]),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales] , &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date])))&lt;BR /&gt;I use the previous formula, in order to appear the Sales LYTD as 0, if the Sales YTD are 0.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It works ok with the values, but not with the Total, where the result keeps summarizing the values i want to exclude.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any idea? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Kostas&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 12 Sep 2023 09:44:40 GMT</pubDate>
    <dc:creator>kostask</dc:creator>
    <dc:date>2023-09-12T09:44:40Z</dc:date>
    <item>
      <title>Summarize data under conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3426005#M129780</link>
      <description>&lt;P&gt;Hi Guys.&lt;/P&gt;&lt;P&gt;I have a sales table with product categories and a calendar table.&lt;/P&gt;&lt;P&gt;I use the below measures to calculate the Sales YTD and LYTD&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales YTD = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; , &lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Instead of : Sales LYTD = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales] , &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date])) , i use:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales LYTD = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales YTD]),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( [Sales] , &lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date])))&lt;BR /&gt;I use the previous formula, in order to appear the Sales LYTD as 0, if the Sales YTD are 0.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It works ok with the values, but not with the Total, where the result keeps summarizing the values i want to exclude.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any idea? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Kostas&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Sep 2023 09:44:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3426005#M129780</guid>
      <dc:creator>kostask</dc:creator>
      <dc:date>2023-09-12T09:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Summarize data under conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3427270#M129892</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="210525" data-lia-user-login="kostask" class="lia-mention lia-mention-user"&gt;kostask&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Mechanically, you achieve your objective by sumxing over the category field which you are bringing in your visualization rows, for row total to correctly add up with what's being shown in the visualization.&amp;nbsp; If you have a saparate category dimension table with one to many relationship with your fact table 'Sales Table' and the category field from the dimension field is properly used in your visualization, the formula will be referencing that dimension table Category field instead.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;A couple of observations:&lt;/P&gt;&lt;P&gt;Since you have properly created the calendar table for date dimension, what about writing the TotalYTD formula like below?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Also, the output produced in the above manner for omitting the previous year sales where there are no sales this year will generate rather misleading information (by omission), and the prior year sales total will not be consistent with the previously reported number.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 23:05:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3427270#M129892</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2023-09-12T23:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Summarize data under conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3428726#M129971</link>
      <description>&lt;P&gt;If you want to exclude categories that have no sales this year in the mausure for the preceding year, that is not very hard to do, but you would need to give more info on your model, specifically if the categories are in a separate dimension, and if so, the columns involved in the relationship between that dimension and the sales fact table.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 14:04:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3428726#M129971</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-09-13T14:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Summarize data under conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3432811#M130170</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;for the solution and the valuable recomendation!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 11:24:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summarize-data-under-conditions/m-p/3432811#M130170</guid>
      <dc:creator>kostask</dc:creator>
      <dc:date>2023-09-15T11:24:13Z</dc:date>
    </item>
  </channel>
</rss>

