<?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: 28 days rolling count of repeats  in power bi Calculated column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762213#M3243</link>
    <description>Thanks,&lt;BR /&gt;Any suggestion on how to do this in Power Query?</description>
    <pubDate>Thu, 08 Aug 2019 21:19:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-08T21:19:10Z</dc:date>
    <item>
      <title>28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/760940#M3198</link>
      <description>Please help!&lt;BR /&gt;&amp;amp;nbsp;&lt;BR /&gt;I am trying to figure out how to calculate a rolling count in power bi calculated column.&lt;BR /&gt;&amp;amp;nbsp;&lt;BR /&gt;For example count the number of each "Name" occurence in the last 28 days.&lt;BR /&gt;&amp;amp;nbsp;&lt;BR /&gt;Also, another calculated column that count the number of occurrence of same "Name" and "Number" over the last 30 days.</description>
      <pubDate>Sat, 10 Aug 2019 07:00:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/760940#M3198</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-10T07:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: 28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/761542#M3220</link>
      <description>This is not a job for DAX. It's a job for Power Query. DAX should only be used for calculated columns if there is NO OTHER OPTION.&lt;BR /&gt;&lt;BR /&gt;Can you please use Power Query to do the above? And if not, why not?&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Thu, 08 Aug 2019 09:19:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/761542#M3220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T09:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: 28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762213#M3243</link>
      <description>Thanks,&lt;BR /&gt;Any suggestion on how to do this in Power Query?</description>
      <pubDate>Thu, 08 Aug 2019 21:19:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762213#M3243</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T21:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: 28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762220#M3245</link>
      <description>Of course. But you have to give me some sample data. Then I'll give you the M code to do what you want.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Thu, 08 Aug 2019 21:32:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762220#M3245</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T21:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: 28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762268#M3246</link>
      <description>&lt;P&gt;OK, I've done it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the M script:&lt;/P&gt;&lt;PRE&gt;let

    Source = &amp;lt;A reference to your table here&amp;gt;,

    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Number", Int64.Type}, {"Name", type text}}),
    #"Buffered Table" = Table.Buffer(#"Changed Type"),
    #"Add Day 28 Days Back" = Table.AddColumn(#"Changed Type", "Date28DaysBack", each [Date] - #duration(27, 0, 0, 0)),
    #"Add Count of Name (28 Days Back)" = Table.AddColumn(
        #"Add Day 28 Days Back", "Count Of Name (28 Days Back)",
        (r) =&amp;gt;
            let
                A = Table.SelectRows(#"Buffered Table", each [Name] = r[Name] and r[Date28DaysBack] &amp;lt;= [Date] and [Date] &amp;lt;= r[Date]),
                CountOfRows = Table.RowCount(A)
            in
                CountOfRows
    ),
    #"Removed Auxiliary Column (28)" = Table.RemoveColumns(#"Add Count of Name (28 Days Back)",{"Date28DaysBack"}),
    #"Add Day 30 Days Back" = Table.AddColumn(#"Removed Auxiliary Column (28)", "Date30DaysBack", each [Date] - #duration(29, 0, 0, 0)),
    #"Add Count of Combination (30 Days Back)" = Table.AddColumn(
        #"Add Day 30 Days Back", "Count Of Combination (30 Days Back)",
        (r) =&amp;gt;
            let
                A = Table.SelectRows(#"Buffered Table", each [Number] = r[Number] and [Name] = r[Name] and r[Date30DaysBack] &amp;lt;= [Date] and [Date] &amp;lt;= r[Date]),
                CountOfRows = Table.RowCount(A)
            in
                CountOfRows
    ),
    #"Removed Auxiliary Column (30)" = Table.RemoveColumns(#"Add Count of Combination (30 Days Back)",{"Date30DaysBack"})
in
    #"Removed Auxiliary Column (30)"&lt;/PRE&gt;&lt;P&gt;And here's what my Source table looks like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 22:52:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/762268#M3246</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T22:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: 28 days rolling count of repeats  in power bi Calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/763343#M3291</link>
      <description>Many thanks for your help Derek.&lt;BR /&gt;It worked on small data set but when I used the M code on a larger data set it kept crashing powerbi after taking forever to load the data. What do you advise?&lt;BR /&gt;I also found out that the code created a table on each row. Is it possible to create just the columns.&lt;BR /&gt;Thanks</description>
      <pubDate>Sat, 10 Aug 2019 11:21:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/28-days-rolling-count-of-repeats-in-power-bi-Calculated-column/m-p/763343#M3291</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-10T11:21:58Z</dc:date>
    </item>
  </channel>
</rss>

