<?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: Count number of price changes for a product over time period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083625#M47331</link>
    <description>&lt;P&gt;Unfortunately not as many items have a sine wave pattern and so the result from distinct gives a much lower figure than expected.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 18 Sep 2021 03:48:19 GMT</pubDate>
    <dc:creator>TrivialSin</dc:creator>
    <dc:date>2021-09-18T03:48:19Z</dc:date>
    <item>
      <title>Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083445#M47314</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I am trying to create a measure of volatility for prices of products over&amp;nbsp; whatever time period is shown in visual, constrined by a slicer.&amp;nbsp; I thought the below would do it but instead the result is something mystical.&amp;nbsp; The price table has about 6000 products with about 750 dated records each.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Volatility = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Price History', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Price History'[Item ID] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Price History'[Price] &amp;lt;&amp;gt; CALCULATE( MIN ('Price History'[Price] ), PREVIOUSDAY('Price History'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;) /&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(COUNTROWS (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;'Price History',&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;'Price History'[Item ID] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&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;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)-1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample data looks like this&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Item ID&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Price&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14/09/2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1079087&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14/09/2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1425434&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;732740.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16/09/2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;386393.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17/09/2021&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;386393.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14/09/2021&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1194536&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14/09/2021&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;1540883&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;848189.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16/09/2021&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;501842.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17/09/2021&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;234734&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13/09/2021&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;1656332&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14/09/2021&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;1656332&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;1656332&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16/09/2021&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;617291.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17/09/2021&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;231325&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;I am trying to get a result for volatility like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Changes&amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Records&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Calculated&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Volatility&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;=3/(5-1)&lt;/TD&gt;&lt;TD&gt;0.75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;=4/(5-1)&lt;/TD&gt;&lt;TD&gt;1.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;=2/(5-1)&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help as to what I am actually calculating&amp;nbsp; using my formula and what I should do to get the right result would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 18:02:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083445#M47314</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T18:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083461#M47317</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;Can you just do a COUNTROWS of the DISTINCT prices? Like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Number of Price Changes = COUNTROWS(DISTINCT(SELECTCOLUMNS('Table',"__Price",[Price])))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 17 Sep 2021 20:09:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083461#M47317</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-09-17T20:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083625#M47331</link>
      <description>&lt;P&gt;Unfortunately not as many items have a sine wave pattern and so the result from distinct gives a much lower figure than expected.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 03:48:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083625#M47331</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T03:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083716#M47333</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Does your result table show the correct value under the Changes column? For Item 6, the change is 1; how did you calculate that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Appreciate your Kudos&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":victory_hand:"&gt;✌️&lt;/span&gt;&lt;STRONG&gt;!!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 07:33:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083716#M47333</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-09-18T07:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083933#M47341</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your data does not allow to calculate the number of changes. For the simple reason that one day can have multiple prices and you don't indicate the temporal order of those prices. If there are 3 prices in a day for a product, then you can have the following cases (just showing some relevant ones):&lt;/P&gt;&lt;P&gt;1) A, A, B -&amp;gt; 1 change&lt;/P&gt;&lt;P&gt;2) A, B, A -&amp;gt; 2 changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even if you have 2 prices in a day, it's still not enough to say what the number of changes is. That's because of such cases:&lt;/P&gt;&lt;P&gt;1) DayBefore: A, CurrentDay: A, B&amp;nbsp; -&amp;gt; 1 change&lt;/P&gt;&lt;P&gt;2) DayBefore:A, CurrentDay: B, A&amp;nbsp; &amp;nbsp;-&amp;gt; 2 changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, this problem is not well defined.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On top of that, your caclulations seem to be incorrect for the table you show.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 13:57:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083933#M47341</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-09-18T13:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083996#M47345</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;So what about a DISTINCT of the date and price columns together?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Number of Price Changes = COUNTROWS(DISTINCT(SELECTCOLUMNS('Table',"__Price",[Price],"__Date",[Date])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 15:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2083996#M47345</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-09-18T15:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084023#M47346</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;Thought about this a little more and came up with the following, seems to return the correct number of changes, 11. Makes the assumption that if on a current day any price is found that matches any price from yesterday that the price did not change between days but only during the day. If that is not a correct assumption, let me know. So, there is a potential to undercount in the case that a price changes from one day to the next and then the price on that same day changes back to the price from yesterday. That would technically be 2 changes but this would only count it as 1. Otherwise, I think it is accurate, it returns 11 from your sample data which is what I calculated by hand:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 3 = 
    VAR __Table = 
        SUMMARIZE(
            'Table14',
            [Date],
            "__DailyChanges",COUNTROWS(DISTINCT('Table14'[Price]))-1           // Get number of changes in same day
        )
    VAR __Table1 = 
        ADDCOLUMNS(
            'Table14',
            "__ChangedSinceYesterday",
                    VAR __CurrentPrices = SELECTCOLUMNS(FILTER(ALL('Table14'),[Date]=EARLIER([Date])),"__Price",[Price])
                    VAR __YesterdayPrices = SELECTCOLUMNS(FILTER(ALL('Table14'),[Date]=EARLIER([Date])-1),"__Price",[Price])
                    VAR __MatchTable = INTERSECT(__CurrentPrices,__YesterdayPrices)
                    VAR __CountYesterday = COUNTROWS(__YesterdayPrices)
                    VAR __Matches = COUNTROWS(__MatchTable)
                RETURN
                    SWITCH(TRUE(),
                        ISBLANK(__CountYesterday),0,
                        ISBLANK(__Matches),1,
                        0
                    )
        )
RETURN
    SUMX(__Table,[__DailyChanges]) + SUMX(SUMMARIZE(__Table1,[Date],[__ChangedSinceYesterday]),[__ChangedSinceYesterday])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 16:01:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084023#M47346</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-09-18T16:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084058#M47347</link>
      <description>&lt;P&gt;It didnt show the right value.&amp;nbsp; Amended.&amp;nbsp; Late night.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 18:23:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084058#M47347</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T18:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084073#M47348</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;I updated the measure to reflect the correct values when broken down by ID:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 3 = 
    VAR __ItemID = MAX('Table14'[Item ID])
    VAR __Table = 
        SUMMARIZE(
            FILTER(ALL('Table14'),[Item ID]=__ItemID),
            [Date],
            "__DailyChanges",COUNTROWS(DISTINCT('Table14'[Price]))-1              // Get number of changes in same day
        )
    VAR __Table1 = 
        ADDCOLUMNS(
            FILTER(ALL('Table14'),[Item ID]=__ItemID),
            "__ChangedSinceYesterday",
                    VAR __CurrentPrices = SELECTCOLUMNS(FILTER(ALL('Table14'),[Item ID]=__ItemID &amp;amp;&amp;amp; [Date]=EARLIER([Date])),"__Price",[Price])
                    VAR __YesterdayPrices = SELECTCOLUMNS(FILTER(ALL('Table14'),[Item ID]=__ItemID &amp;amp;&amp;amp; [Date]=EARLIER([Date])-1),"__Price",[Price])
                    VAR __MatchTable = INTERSECT(__CurrentPrices,__YesterdayPrices)
                    VAR __CountYesterday = COUNTROWS(__YesterdayPrices)
                    VAR __Matches = COUNTROWS(__MatchTable)
                RETURN
                    SWITCH(TRUE(),
                        ISBLANK(__CountYesterday),0,
                        ISBLANK(__Matches),1,
                        0
                    )
        )
RETURN
    SUMX(__Table,[__DailyChanges]) + SUMX(SUMMARIZE(__Table1,[Date],[__ChangedSinceYesterday]),[__ChangedSinceYesterday])&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Sep 2021 18:45:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084073#M47348</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-09-18T18:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084075#M47349</link>
      <description>&lt;P&gt;Hi Greg. I will be spending several hours going through your last response to see how that works. I think this solution only accounts for having one product though. The formatting in the table on my original post was poor. I have many products in the price table so there was actually an "Item ID" column between date and price.&lt;BR /&gt;&lt;BR /&gt;I am using data from a game as a source of motivation to learn how I can utilise Power BI in my workplace environement.&amp;nbsp; This is in combination with The Definitve Guide to Dax and the wealth of internet material (Just added your book to my digital shelf on Kindle as well) .&amp;nbsp; &amp;nbsp; I have made good progress but I just cant get my head round how to achieve the result for these price changes. This is the first time I have had to reach out for help and your time in responding is greatly appreciated. I wont just cut n paste an answer and then forget about it. I will disect the solution to see how it was achieved.&lt;BR /&gt;&lt;BR /&gt;My current reading makes me think RankX needs to be involved somewhere. My original thoughts were that I would need to create a filtered table containing the records (This could be up to 750 rows spanning the last 18 months) for the product( ItemID) and then compare the current row against the previous row for each row in the filtered table, counting the rows where the price is not equal.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To give some context, the volatility figure is to end up as a column in my current learning experiment below where Item Name maps to an Item ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 19:05:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084075#M47349</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T19:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084082#M47350</link>
      <description>&lt;P&gt;&amp;nbsp;I have no aversion to critique but could you also point me toward something positive to aid my learning?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 19:02:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084082#M47350</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T19:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084133#M47352</link>
      <description>&lt;P&gt;Amazing.&amp;nbsp; That gives exactly what I was looking for.&amp;nbsp; I have removed the "ALL" from the various places as I wanted to be able to see the volatility over the filtered period based on a date slicer on the page.&amp;nbsp; &amp;nbsp;As the "live" table has 6000 item IDs and 4.6M records, I didnt fancy my chances on how many calculations that would take to complete a full run either.&amp;nbsp; &amp;nbsp;I will wait a few more weeks until I have absorbed significantly more understanding before tackling optimisation.&amp;nbsp; Thank you so much for&amp;nbsp; this.&amp;nbsp; &amp;nbsp; Hope your book is a good read.&amp;nbsp; I will make sure I leave a review.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 20:09:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084133#M47352</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T20:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084149#M47353</link>
      <description>&lt;P&gt;I know you have solved my original puzzle but&amp;nbsp; just wondering what if, I only ever had 1 price per ID, per day, could I follow my original train of thought and create a filtered table with only the entries for the current Item ID and then use your formula above to isolate the changes?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 20:37:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084149#M47353</guid>
      <dc:creator>TrivialSin</dc:creator>
      <dc:date>2021-09-18T20:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of price changes for a product over time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084182#M47355</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="326068" data-lia-user-login="TrivialSin" class="lia-mention lia-mention-user"&gt;TrivialSin&lt;/a&gt;&amp;nbsp;If you only had 1 price per ID per day then that becomes more of a MTBF sort of thing where you just need to check the "previous" row.&amp;nbsp;See my article on Mean Time Between Failure (MTBF): &lt;A href="http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586" target="_blank"&gt;http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586&lt;/A&gt;.&lt;BR /&gt;The basic pattern is:&lt;BR /&gt;Column =&amp;nbsp;&lt;BR /&gt;&amp;nbsp; VAR __Current = [Value]&lt;BR /&gt;&amp;nbsp; VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] &amp;lt; EARLIER('Table'[Date])),[Date])&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])&lt;BR /&gt;RETURN&lt;BR /&gt;&amp;nbsp; __Current - __Previous&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 23:38:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-price-changes-for-a-product-over-time-period/m-p/2084182#M47355</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-09-18T23:38:15Z</dc:date>
    </item>
  </channel>
</rss>

