<?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: Total for last 30 days when no entries for particular dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222904#M117891</link>
    <description>&lt;P&gt;Thank you!!. I had tried that, but for some reason I hadn't added the date table date to the visual's X axis, so I'd disregarded that approach and gone back to trying to do something more Dax-y.&lt;/P&gt;&lt;P&gt;Much appreciated. It was driving me mad!&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 22:04:40 GMT</pubDate>
    <dc:creator>Coriel-11</dc:creator>
    <dc:date>2023-05-05T22:04:40Z</dc:date>
    <item>
      <title>Total for last 30 days when no entries for particular dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222548#M117848</link>
      <description>&lt;P&gt;I have a table which is essentially like the one below.&amp;nbsp; Each time one gives us a "Sentiment" of Positive/Neutral/Negative/Unclassified that sentiment is added as a new line, along with the date.&lt;/P&gt;&lt;P&gt;I have dates that go back to the start of the year so I want to record how many of each category have been recorded over the previous 30 days (including the day in question), so I can produce 100% stacked chart like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So I created this measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sentiment MMT = 
    CALCULATE( 
        Count(Sentiment[Sentiment]),
        DATESINPERIOD(
          'Sentiment'[Date],
            MAX('Sentiment'[Date]),
           -1,MONTH
       )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm having is that if on one of the days it happens that no-one recorded a particular sentiment, then rather than counting up all entries for the other 29 days, it just returns a blank – you can see wome exmaples in the bottom right where there are no grey values.&lt;BR /&gt;&lt;BR /&gt;An example of the data (which doesn't correspond precisely to the chart , it's just to give you an idea)&amp;nbsp; is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Sentiment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-23&lt;/TD&gt;&lt;TD&gt;Unclassified&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Neutral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29-Apr-23&lt;/TD&gt;&lt;TD&gt;Positive&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;etc.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 16:01:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222548#M117848</guid>
      <dc:creator>Coriel-11</dc:creator>
      <dc:date>2023-05-05T16:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Total for last 30 days when no entries for particular dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222622#M117861</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="304230" data-lia-user-login="Coriel-11" class="lia-mention lia-mention-user"&gt;Coriel-11&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Create a DATES table, Link the dates table to your fast table using a one-to-many relation and modify your calculation. Make sure you use the Date column from your Dates table in the Visual. Create a Copy of the Dates table for date selection as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here is the modified formula:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sentiment MMT = 
VAR __DateSelected = SELECTEDVALUE('Date Selector'[Date])
VAR __CurrentDate = SELECTEDVALUE('Dates'[Date])
VAR __Period = 
    DATESINPERIOD(
          'Dates'[Date],
            __CurrentDate,
           1,
           MONTH
       )
Return

IF(
    __DateSelected IN __Period,
    CALCULATE( 
        Count(Sentiment[Sentiment]),
        __Period 
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;File is attached&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 21:42:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222622#M117861</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2023-05-05T21:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Total for last 30 days when no entries for particular dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222904#M117891</link>
      <description>&lt;P&gt;Thank you!!. I had tried that, but for some reason I hadn't added the date table date to the visual's X axis, so I'd disregarded that approach and gone back to trying to do something more Dax-y.&lt;/P&gt;&lt;P&gt;Much appreciated. It was driving me mad!&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 22:04:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-for-last-30-days-when-no-entries-for-particular-dates/m-p/3222904#M117891</guid>
      <dc:creator>Coriel-11</dc:creator>
      <dc:date>2023-05-05T22:04:40Z</dc:date>
    </item>
  </channel>
</rss>

