<?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: Different result for DAX measure when filtered out only relevant records with COUNTROWS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054306#M14492</link>
    <description>The answer is obvious if you know how DAX works. By putting a filter on Year, you are calculating your functions with this filter on. You do not take it off at all in your functions. PREVIOUSMONTH works the way you'd expect ONLY IF YOU HAVE A CORRECT DATE TABLE IN THE MODEL. With all dates in it and marked as the Date table. Please do yourself a favor. Create a normal, correct Date table, connect it to your fact, mark it as the Date table in the model and hide the Date column in it (as you don't need it). Then and only then, if you start using time-intel functions with the Date column, you'll get correct answers. Please always use time-intel functions with a PROPER CALENDAR. Do not cut corners.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
    <pubDate>Tue, 28 Apr 2020 17:35:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-04-28T17:35:38Z</dc:date>
    <item>
      <title>Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1053654#M14456</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a relatively simple measure for calculating differences of volumes between months.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = SUM(Volume) - CALCULATE(SUM(Volume),PREVIOUSMONTH(MonthPeriod))&lt;/LI-CODE&gt;&lt;P&gt;It works good in general but there are some issues.&lt;/P&gt;&lt;P&gt;I want to see only relevant months so I created a measure in my fact table and applied this measure as a filter on the visual where Rows are greater than or equal 1:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rows = COUNTROWS(FactTable)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And finally, I have a slicer for year selection. When I choose one year or all it works good but when I choose more years from slicer I receive wrong value on the start of each year (not the delta but only the SUM(Volume). The reason is that CALCULATE(SUM(Volume),PREVIOUSMONTH(MonthPeriod)) is null for the first month of each selected year. I don't know why. For the first selected year, it is understandable but why for the second selected as well?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone help me, please?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:10:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1053654#M14456</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-28T13:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054117#M14480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="64216" data-lia-user-login="soldous" class="lia-mention lia-mention-user"&gt;soldous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PREVIOUSMONTH function is a Time intelligence function so it requires Date Dimension or Or Auto Date/Time Hierarchies&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you using the Date Dimension / Calendar Table to work correctly?&amp;nbsp;&lt;BR /&gt;&lt;A href="https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns" target="_blank" rel="noopener"&gt;https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/automatic-time-intelligence-in-power-bi" target="_blank" rel="noopener"&gt;https://www.sqlbi.com/articles/automatic-time-intelligence-in-power-bi&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;Best Regards,&lt;BR /&gt;Mariusz&lt;BR /&gt;&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accepting it as the solution&lt;/I&gt;&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Please feel free to connect with me.&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/mariusz-repczynski-065a7362/" target="_blank" rel="noopener"&gt; LinkedIn &lt;/A&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 16:03:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054117#M14480</guid>
      <dc:creator>Mariusz</dc:creator>
      <dc:date>2020-04-28T16:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054142#M14482</link>
      <description>&lt;P&gt;Hello Mariusz,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, basically yes. I use a date dimension but not to the day granularity but only to month granularity. We basically have records for each first day of the month. I also set this table as Date Table.&lt;/P&gt;&lt;P&gt;The strangest thing for me is that when I don't filter the visual with COUNTROWS it works. But it also adds one more column to the end where there are no records for the current month but PREVIOUSMONTH gives me the last month. So I need the COUNTROWS filter and then it doesn't work.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 16:13:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054142#M14482</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-28T16:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054167#M14484</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="64216" data-lia-user-login="soldous" class="lia-mention lia-mention-user"&gt;soldous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I imagine that PREVIOUSMONTH would return BLANK in the first month as there will be no data, have you investigated what this part of your measure return in these situations?&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;CALCULATE(SUM(Volume),PREVIOUSMONTH(MonthPeriod))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;Best Regards,&lt;BR /&gt;Mariusz&lt;BR /&gt;&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accepting it as the solution&lt;/I&gt;&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Please feel free to connect with me.&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/mariusz-repczynski-065a7362/" target="_blank"&gt; LinkedIn &lt;/A&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 16:25:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054167#M14484</guid>
      <dc:creator>Mariusz</dc:creator>
      <dc:date>2020-04-28T16:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054219#M14486</link>
      <description>&lt;P&gt;I added two pictures for better understanding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the first picture, you can see the situation with more selection in the slicer and bad result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;And on the second picture, you can see the situation when all months from slicer are selected. So basically the same situation but with the different and correct result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 16:51:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054219#M14486</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-28T16:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054306#M14492</link>
      <description>The answer is obvious if you know how DAX works. By putting a filter on Year, you are calculating your functions with this filter on. You do not take it off at all in your functions. PREVIOUSMONTH works the way you'd expect ONLY IF YOU HAVE A CORRECT DATE TABLE IN THE MODEL. With all dates in it and marked as the Date table. Please do yourself a favor. Create a normal, correct Date table, connect it to your fact, mark it as the Date table in the model and hide the Date column in it (as you don't need it). Then and only then, if you start using time-intel functions with the Date column, you'll get correct answers. Please always use time-intel functions with a PROPER CALENDAR. Do not cut corners.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Tue, 28 Apr 2020 17:35:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1054306#M14492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-28T17:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055782#M14547</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your feedback.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed the date dimension to complete date dimension with date field for each date. The model is in the SSAS and the table is marked as Date Table with this whole date column as a unique identifier.&lt;/P&gt;&lt;P&gt;But the situation with the measure is the same.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 08:36:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055782#M14547</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-29T08:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055836#M14549</link>
      <description>&lt;P&gt;You could create a previous month measure without using the previousmonth function. Simply get the month in the context and then subtract 1 from it. You can also test for if the year has been filtered using hasonevalue etc.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 08:56:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055836#M14549</guid>
      <dc:creator>sanimesa</dc:creator>
      <dc:date>2020-04-29T08:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055849#M14552</link>
      <description>&lt;P&gt;Hello, sanimesa,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;I've already tried DATEADD(MonthPeriod,-1,Month) or&amp;nbsp;&lt;SPAN&gt;PARALLELPERIOD(MonthPeriod,-1,Month). ParallelPeriod gives me the same result as PreviousMonth. DateAdd gives me completely wrong results with many blanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 09:04:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055849#M14552</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-29T09:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055977#M14559</link>
      <description>&lt;P&gt;DATEADD( MonthPeriod, -1, MONTH )? Is MonthPeriod a DATE? If it's not, then you know why it does not work. As I already said, time-intel functions need a date column (without gaps) to work correctly.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 09:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1055977#M14559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-29T09:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Different result for DAX measure when filtered out only relevant records with COUNTROWS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1056144#M14561</link>
      <description>&lt;P&gt;That's it! I didn't get it on the first time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 10:23:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-for-DAX-measure-when-filtered-out-only-relevant/m-p/1056144#M14561</guid>
      <dc:creator>soldous</dc:creator>
      <dc:date>2020-04-29T10:23:50Z</dc:date>
    </item>
  </channel>
</rss>

