<?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 calculate difference between current and previous month - show values for all categories in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-difference-between-current-and-previous-month-show/m-p/1056414#M14571</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a model in Power pivot one with so called Keys which is related to my main data (Category,Key,Date, Value)&lt;/P&gt;&lt;P&gt;I have a slicer with months and pivot table which shows Key and calculated values from main table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to show difference between selected month and previous month and I am using those measures&lt;/P&gt;&lt;P&gt;Total = sum(Main[Value])&lt;/P&gt;&lt;P&gt;PreviousMonthTotal = calculate([Total], previousmonth(Main[Date])&lt;/P&gt;&lt;P&gt;It works nice however I need to calculate difference between it and if specific key didnt exist in data for current month it should show previous one and the other way, if its not in current then still show key but with blank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately it shows only keys which exist in month selected on slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if in pivot table I only show grouped values by category results are correct, but when I go to maximum granularity (key) it doesnt show me exact resutlts.&lt;/P&gt;&lt;P&gt;How can I force it to show in pivot table all keys from those two months?&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 12:24:00 GMT</pubDate>
    <dc:creator>Werdinkaa</dc:creator>
    <dc:date>2020-04-29T12:24:00Z</dc:date>
    <item>
      <title>DAX calculate difference between current and previous month - show values for all categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-difference-between-current-and-previous-month-show/m-p/1056414#M14571</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a model in Power pivot one with so called Keys which is related to my main data (Category,Key,Date, Value)&lt;/P&gt;&lt;P&gt;I have a slicer with months and pivot table which shows Key and calculated values from main table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to show difference between selected month and previous month and I am using those measures&lt;/P&gt;&lt;P&gt;Total = sum(Main[Value])&lt;/P&gt;&lt;P&gt;PreviousMonthTotal = calculate([Total], previousmonth(Main[Date])&lt;/P&gt;&lt;P&gt;It works nice however I need to calculate difference between it and if specific key didnt exist in data for current month it should show previous one and the other way, if its not in current then still show key but with blank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately it shows only keys which exist in month selected on slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if in pivot table I only show grouped values by category results are correct, but when I go to maximum granularity (key) it doesnt show me exact resutlts.&lt;/P&gt;&lt;P&gt;How can I force it to show in pivot table all keys from those two months?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 12:24:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-difference-between-current-and-previous-month-show/m-p/1056414#M14571</guid>
      <dc:creator>Werdinkaa</dc:creator>
      <dc:date>2020-04-29T12:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculate difference between current and previous month - show values for all categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-difference-between-current-and-previous-month-show/m-p/1077607#M15145</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="138717" data-lia-user-login="Werdinkaa" class="lia-mention lia-mention-user"&gt;Werdinkaa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can try to create a seprate dim table first. (keep no relationship with the main table)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CategoryTable = Distinct('Main'[Category])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then replace the measure total as following to meet your requirement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total =
CALCULATE (
    SUM ( Main[Value] ),
    Main[Category] IN DISTINCT ( CategoryTable[Category] )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to OneDrive For Business and share the link here.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 00:44:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-difference-between-current-and-previous-month-show/m-p/1077607#M15145</guid>
      <dc:creator>v-lid-msft</dc:creator>
      <dc:date>2020-05-07T00:44:31Z</dc:date>
    </item>
  </channel>
</rss>

