<?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: Simple Linear Regression in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315972#M83</link>
    <description>&lt;P&gt;Wow, 391 years of data&amp;nbsp;sounds exciting :-) If you could reduce your data to the minimum amount with which you could reproduce your formula problems, that would be great.&lt;/P&gt;</description>
    <pubDate>Sat, 02 Dec 2017 13:34:48 GMT</pubDate>
    <dc:creator>Daniil</dc:creator>
    <dc:date>2017-12-02T13:34:48Z</dc:date>
    <item>
      <title>Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/247439#M55</link>
      <description>&lt;P&gt;This measure allows you&amp;nbsp;to&amp;nbsp;predict dependent values Y from independent values X.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 id="toc-hId--1323657085"&gt;NAME:&lt;/H4&gt;
&lt;P&gt;Simple linear regression&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 id="toc-hId-419153250"&gt;DESCRIPTION:&lt;/H4&gt;
&lt;P&gt;Estimate Y values based on X values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 id="toc-hId--2133003711"&gt;PARAMETERS:&lt;/H4&gt;
&lt;P&gt;Name: Category&lt;/P&gt;
&lt;P&gt;Tooltip: The category for&amp;nbsp;which you&amp;nbsp;have known X and Y values&lt;/P&gt;
&lt;P&gt;Type: Categorical field&lt;/P&gt;
&lt;H4 id="toc-hId--2133003711"&gt;&amp;nbsp;&lt;/H4&gt;
&lt;P&gt;Name:&amp;nbsp;Measure X&lt;/P&gt;
&lt;P&gt;Tooltip:&amp;nbsp;Known X (independent) values&lt;/P&gt;
&lt;P&gt;Type: Numerical field / measure&lt;/P&gt;
&lt;H4 id="toc-hId--2133003711"&gt;&amp;nbsp;&lt;/H4&gt;
&lt;P&gt;Name:&amp;nbsp;Measure&amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;Tooltip:&amp;nbsp;Known Y (dependent) values&lt;/P&gt;
&lt;P&gt;Type: Numerical field / measure&lt;/P&gt;
&lt;H4 id="toc-hId--390193376"&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4 id="toc-hId-1352616959"&gt;DAX:&lt;/H4&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Estimated {Measure Y} =
VAR Known =
    FILTER (
        SELECTCOLUMNS (
            ALLSELECTED ( &lt;SPAN class="pastel-red"&gt;{Category}&lt;/SPAN&gt; ),
            "Known[X]", CALCULATE ( {Measure X} ),
            "Known[Y]", CALCULATE ( {Measure Y} )
        ),
        AND (
            NOT ( ISBLANK ( Known[X] ) ),
            NOT ( ISBLANK ( Known[Y] ) )
        )
    )
VAR Count_Items =
    COUNTROWS ( Known )
VAR Sum_X =
    SUMX ( Known, Known[X] )
VAR Sum_X2 =
    SUMX ( Known, Known[X] ^ 2 )
VAR Sum_Y =
    SUMX ( Known, Known[Y] )
VAR Sum_XY =
    SUMX ( Known, Known[X] * Known[Y] )
VAR Average_X =
    AVERAGEX ( Known, Known[X] )
VAR Average_Y =
    AVERAGEX ( Known, Known[Y] )
VAR Slope =
    DIVIDE (
        Count_Items * Sum_XY - Sum_X * Sum_Y,
        Count_Items * Sum_X2 - Sum_X ^ 2
    )
VAR Intercept =
    Average_Y - Slope * Average_X
RETURN
    Intercept + Slope * {Measure X}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;For more details on and other uses of this quick measure, see my blog post on the subject:&lt;/P&gt;
&lt;P&gt;&lt;A title="XXL BI" href="https://xxlbi.com/blog/simple-linear-regression-in-dax/" target="_self"&gt;https://xxlbi.com/blog/simple-linear-regression-in-dax/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiZWNiNTQ2MGEtMjhlNS00YTNhLWE2NTktZDg3MzcxMjQ0NDc4IiwidCI6ImQzMmNkYzNmLTY1NTUtNGNhYy1iYjFhLTg2OWZiMTE0MzRlNSJ9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 06:19:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/247439#M55</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2018-04-13T06:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/311592#M70</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am using your Simple Linear Regression measure with great success. Thank You.&lt;/P&gt;
&lt;P&gt;I am doing temperature studies and I want to find the first and last values of your measure in a given time interval which is filtered by a slicer. By doing this I can calculate the difference in the trend line over the interval of filtered years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;can find the first and last &lt;STRONG&gt;year&lt;/STRONG&gt; of the filtered interval by using FIRSTNONBLANK&amp;nbsp;and&amp;nbsp;LASTNONBLANK but I can't do&amp;nbsp;this with your code because &amp;nbsp;FIRSTNONBLANK&amp;nbsp;and&amp;nbsp;LASTNONBLANK only accept a column as an argument. I cannot seem to convert your measure into a calculated column to do this. Is there a version of your measure that produces a column? My data has two columns &lt;STRONG&gt;year&lt;/STRONG&gt; and &lt;STRONG&gt;temperature. &lt;/STRONG&gt;X and Y.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony Maclaren&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 13:16:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/311592#M70</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-11-27T13:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/312407#M71</link>
      <description>&lt;P&gt;Thanks for your feedback, Tony!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understand you correctly, there are a few ways to achieve your goal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of a measure:&lt;/P&gt;
&lt;PRE&gt;Starting Temperature =
VAR Known =
    FILTER (
        SELECTCOLUMNS (
            ALLSELECTED ( 'Table'[Year] ),
            "Known[X]", 'Table'[Year] ),
            "Known[Y]", [Temperature]
        ),
        AND (
            NOT ( ISBLANK ( Known[X] ) ),
            NOT ( ISBLANK ( Known[Y] ) )
        )
    )
VAR First =
    TOPN ( 1, Known, Known[X], ASC )
RETURN
    MINX ( First, Known[Y] )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 08:59:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/312407#M71</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-11-28T08:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/312991#M72</link>
      <description>&lt;P&gt;Dear Daniil&lt;/P&gt;
&lt;P&gt;Thank you for your very prompt response. I will be in Sydney, where I grew up, in early December!&lt;/P&gt;
&lt;P&gt;Here is the tweaked code below (minus some brackets) that does the trick.Thank you so much.&lt;/P&gt;
&lt;P&gt;This is an&lt;STRONG&gt; incredibly useful&lt;/STRONG&gt;&amp;nbsp; companion measure to your Simple Linear Regression measure, and because it works with measures it will find the equivalent of FIRSTNONBLANK in&amp;nbsp;&lt;STRONG&gt;a measure&lt;/STRONG&gt;. However it does not work correctly in the filtered context of a&amp;nbsp;YEAR slider to&amp;nbsp;filter the interval of years which the Simple Linear Regression measure does&amp;nbsp;.The value changes with the slider, but the results do not correctly match the estimated starting value of the &lt;STRONG&gt;Estimated&lt;/STRONG&gt; measure except for the first value of the whole dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Starting Temperature = &lt;BR /&gt;VAR Known =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECTCOLUMNS (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ALLSELECTED ( 'cetdata'[YEAR] ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Known[X]", 'cetdata'[YEAR],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Known[Y]", [Estimated]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT ( ISBLANK ( Known[X] ) ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT ( ISBLANK ( Known[Y] ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;VAR First =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TOPN ( 1, Known, Known[X], ASC )&lt;BR /&gt;RETURN&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MINX ( First, Known[Y] )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT ( ISBLANK ( Known[Y] ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;VAR First =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TOPN ( 1, Known, Known[X], ASC )&lt;BR /&gt;RETURN&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MINX ( First, Known[Y] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now we have to fix the filter context and figure out how to find [&lt;STRONG&gt;Ending temperature&lt;/STRONG&gt;] so we can subtract &lt;STRONG&gt;[Starting Temperature]&lt;/STRONG&gt; and get the trend change per filtered interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again--great stuff. No one else had a clue what my problem was or how to solve it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:35:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/312991#M72</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-11-28T19:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/313299#M73</link>
      <description>&lt;P&gt;Tony,&amp;nbsp;you should visit the local Power BI User Group if you get a chance :-) The next meeting date should be announced at &lt;A title="Sydney Power BI User Group" href="https://www.meetup.com/en-AU/Sydney-Modern-Excel-Power-BI-User-Group/" target="_self"&gt;Meetup&lt;/A&gt;&amp;nbsp;soon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the following measures:&lt;/P&gt;
&lt;PRE&gt;Starting Temperature = 
VAR Estimate =
    SELECTCOLUMNS (
        KEEPFILTERS ( ALLSELECTED ( 'cetdata'[YEAR] ) ),
        "Estimate[X]", 'cetdata'[YEAR],
        "Estimate[Y]", [Estimated]
    )
VAR First =
    TOPN ( 1, Estimate, Estimate[X], ASC )
RETURN
    MINX ( First, Estimate[Y] )&lt;/PRE&gt;
&lt;PRE&gt;Ending Temperature = 
VAR Estimate =
    SELECTCOLUMNS (
        KEEPFILTERS ( ALLSELECTED ( 'cetdata'[YEAR] ) ),
        "Estimate[X]", 'cetdata'[YEAR],
        "Estimate[Y]", [Estimated]
    )
VAR Last =
    TOPN ( 1, Estimate, Estimate[X], DESC )
RETURN
    MAXX ( Last, Estimate[Y] )&lt;/PRE&gt;
&lt;PRE&gt;Temperature Difference = [Ending Temperature] - [Starting Temperature]&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2017 03:24:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/313299#M73</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-11-29T03:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/313832#M74</link>
      <description>&lt;P&gt;Dear Daniil&lt;/P&gt;
&lt;P&gt;Thank you very much--all working perfectly now. KEEPFILTERS did the trick.I have really learned a lot! I have now ordered the SQLBI book.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One strange thing however,The [Estimated]&amp;nbsp;measure which is&amp;nbsp;your Simple linear Regression measure produces a total if displayed in a table. I do not quite understand this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;and thanks again&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 13:43:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/313832#M74</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-11-29T13:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315666#M75</link>
      <description>&lt;P&gt;Really excellent stuff !!&lt;/P&gt;
&lt;P&gt;I had managed to do a linear regression line previously but this is so much cleaner&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have to tweak yours slightly&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Instead of a plain old Allselected i needed to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALCULATETABLE (&lt;BR /&gt; SUMMARIZE (&lt;BR /&gt; FeederHistory,&lt;BR /&gt; FeederHistory[EventDateHour],&lt;BR /&gt; FeederHistory[EventDate]&lt;BR /&gt; ),&lt;BR /&gt; ALLSELECTED ( FeederHistory )&lt;BR /&gt; ),&lt;/P&gt;
&lt;P&gt;and for some reason SSRS moaned at me for using SELCTEDVALUE so I replaced it with the older hasonevalue values paradigm&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ie&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt; Intercept&lt;BR /&gt; + Slope&lt;BR /&gt; * IF (&lt;BR /&gt; HASONEVALUE ( FeederHistory[EventDate] ),&lt;BR /&gt; VALUES ( FeederHistory[EventDate] ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 12:45:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315666#M75</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-01T12:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315668#M76</link>
      <description>&lt;P&gt;Really excellent stuff !!&lt;/P&gt;
&lt;P&gt;I had managed to do a linear regression line previously but this is so much cleaner&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have to tweak yours slightly&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Instead of a plain old Allselected i needed to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALCULATETABLE (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;FeederHistory,&lt;BR /&gt;FeederHistory[EventDateHour],&lt;BR /&gt;FeederHistory[EventDate]&lt;BR /&gt;),&lt;BR /&gt;ALLSELECTED ( FeederHistory )&lt;BR /&gt;),&lt;/P&gt;
&lt;P&gt;and for some reason SSRS moaned at me for using SELCTEDVALUE so I replaced it with the older hasonevalue values paradigm&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ie&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;Intercept&lt;BR /&gt;+ Slope&lt;BR /&gt;* IF (&lt;BR /&gt;HASONEVALUE ( FeederHistory[EventDate] ),&lt;BR /&gt;VALUES ( FeederHistory[EventDate] ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 12:48:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315668#M76</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-01T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315670#M77</link>
      <description>&lt;P&gt;I know this is a Power Bi portal but I had to make it work for both PBI and SSRS&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 12:51:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315670#M77</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-01T12:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315795#M78</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Thanks for your comments. If, like me you ever need to get the first and last values for a given filtered interval to calculate the total trend change over time, or rate of trend change over time, the Starting and Ending measures are great. When you get something like this working it really puts a smile on your face! With these complicated measures I can highly recomment DAX formatter if you are not already using it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.daxformatter.com/" target="_blank"&gt;http://www.daxformatter.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 17:04:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315795#M78</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-12-01T17:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315923#M79</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="47472" data-lia-user-login="tonymaclaren" class="lia-mention lia-mention-user"&gt;tonymaclaren&lt;/a&gt;,&amp;nbsp;it is likely that at the grand total level what you see is not a total, but the Intercept. This is because the following expression evaluates to Intercept:&lt;/P&gt;
&lt;PRE&gt;Intercept + Slope * SELECTEDVALUE ( 'cetdata'[YEAR] )&lt;/PRE&gt;
&lt;P&gt;At the grant total level, there is usually more than one&amp;nbsp;'cetdata'[YEAR], hence&amp;nbsp;SELECTEDVALUE ( 'cetdata'[YEAR] ) returns BLANK, turning the multiplication into BLANK as well, leaving only Intercept.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I updated my blog post to deal with this kind of situations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anonymous&lt;/a&gt;,&amp;nbsp;glad you found this useful!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 03:56:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315923#M79</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-12-02T03:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315951#M80</link>
      <description>&lt;P&gt;Dar Daniil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the explanation.The same value&amp;nbsp;also appears at the top of the [Estimated] measure, but only if the whole of the data for ('Ctedata'[YEAR])is displayed. is there a modification to eliminate this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 10:26:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315951#M80</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-12-02T10:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315962#M81</link>
      <description>&lt;P&gt;Tony, it's a bit difficult to advise anything without seeing your&amp;nbsp;report&amp;nbsp;-- can you share a sample of your data?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 11:20:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315962#M81</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-12-02T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315967#M82</link>
      <description>&lt;P&gt;Hi Daniil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure, no problem.What would you like me to supply and how.The full dataset is for 391 years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 12:27:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315967#M82</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-12-02T12:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315972#M83</link>
      <description>&lt;P&gt;Wow, 391 years of data&amp;nbsp;sounds exciting :-) If you could reduce your data to the minimum amount with which you could reproduce your formula problems, that would be great.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 13:34:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315972#M83</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-12-02T13:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315986#M84</link>
      <description>&lt;P&gt;Thanks Daniil&lt;/P&gt;
&lt;P&gt;I have attached a subset of the file that exhibits the exact same problem using the following&amp;nbsp;measure:&lt;/P&gt;
&lt;P&gt;Estimated tony Data = &lt;BR /&gt;VAR Known =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECTCOLUMNS (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ALLSELECTED ( 'Tony_data'[YEAR] ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Known[X]", 'Tony_data'[YEAR],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Known[Y]", [Averagetemp]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT ( ISBLANK ( Known[X] ) ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOT ( ISBLANK ( Known[Y] ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;VAR Count_Items =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COUNTROWS ( Known )&lt;BR /&gt;VAR Sum_X =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUMX ( Known, Known[X] )&lt;BR /&gt;VAR Sum_X2 =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUMX ( Known, Known[X] ^ 2 )&lt;BR /&gt;VAR Sum_Y =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUMX ( Known, Known[Y] )&lt;BR /&gt;VAR Sum_XY =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUMX ( Known, Known[X] * Known[Y] )&lt;BR /&gt;VAR Average_X =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AVERAGEX ( Known, Known[X] )&lt;BR /&gt;VAR Average_Y =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AVERAGEX ( Known, Known[Y] )&lt;BR /&gt;VAR Slope =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DIVIDE (&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count_Items * Sum_XY - Sum_X * Sum_Y,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count_Items * Sum_X2 - Sum_X ^ 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;VAR Intercept =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Average_Y - Slope * Average_X&lt;BR /&gt;RETURN&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Intercept + Slope * SELECTEDVALUE ( 'Tony_data'[YEAR])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Averagetemp = SUM(Tony_data[AverageTemperature])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 15:18:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/315986#M84</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-12-02T15:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/316006#M85</link>
      <description>&lt;P&gt;Tony, I can't reproduce the problem, unfortunately. Can you please attach a pbix file and screenshots with the problem highlighted?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, have you followed my updated blog post? I don't use SELECTEDVALUE anymore:&amp;nbsp;&lt;A href="https://xxlbi.com/blog/simple-linear-regression-in-dax/" target="_blank"&gt;https://xxlbi.com/blog/simple-linear-regression-in-dax/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2017 21:56:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/316006#M85</guid>
      <dc:creator>Daniil</dc:creator>
      <dc:date>2017-12-02T21:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/316130#M86</link>
      <description>&lt;P&gt;Hi Daniil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for all your help. I have attached the whole file because it might interest you anyway. I sholuld stress it is a work in progress and my first use of Power BI. Please keep it to yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The page labeled &lt;STRONG&gt;Tony Data&lt;/STRONG&gt; with the table in it shows the problem clearly--although it does not reproduce in the chart on that page. It is not really a problem, but it would be nice for us to understand the behaviour.Play around with the date slider and you will notice that if you&amp;nbsp;set the start date to 1960&lt;STRONG&gt; only&lt;/STRONG&gt; you see -32.72 at the &lt;STRONG&gt;top&lt;/STRONG&gt; and &lt;STRONG&gt;bottom&lt;/STRONG&gt; of the [Estimated Tony Data] column. Other start dates do not exhibit this problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will take a look at the blog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tony&lt;/P&gt;</description>
      <pubDate>Sun, 03 Dec 2017 16:57:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/316130#M86</guid>
      <dc:creator>tonymaclaren</dc:creator>
      <dc:date>2017-12-03T16:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/404290#M140</link>
      <description>&lt;P&gt;Aye Tony, hope my suggestion could work for you with such problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try replacing this part:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#999999"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Intercept + Slope * SELECTEDVALUE ( 'Tony_data'[YEAR])&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#999999"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUMX( Tony_data , &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&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; Intercept + Slope * SELECTEDVALUE ( 'Tony_data'[YEAR])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&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; )&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Btw, this one is the very first reply of mine in this place, so HELLO WORLD then :'&amp;gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 14:41:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/404290#M140</guid>
      <dc:creator>leanh</dc:creator>
      <dc:date>2018-04-25T14:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Linear Regression</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/412906#M151</link>
      <description>&lt;P&gt;Thanks for the measure Daniil, it is extremely helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am attempting to apply it to a forecasting problem that is relatively simple in excel, but is causing some trouble for me with Dax/PowerBI. I have 19 different categories that I need to run the regression on, and then I need to sum those categories for use on further regressions. Could your measure be modified to accomplish this or do I need to create 19 different measures?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any help you could provide.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 15:00:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Simple-Linear-Regression/m-p/412906#M151</guid>
      <dc:creator>jwjwjwjwjw</dc:creator>
      <dc:date>2018-05-08T15:00:19Z</dc:date>
    </item>
  </channel>
</rss>

