

If you think this pattern is useful, please give kudos to it in the Quick Measures Gallery. With simple linear regression, you can calculate them yourself, as long as you have sequential numeric values to use as known X values As soon as you use strings (month names, for instance), you lose the ability to add trend lines. As of September 2017, Power BI allows you to only add trend lines for numeric or datetime axes.With the built-in trend line, you can only infer its values from the Y axis, while the calculated trend line allows you to see the values explicitly.There are at least two reasons to consider calculated trend lines: The red line looks a lot like a trend line, doesn’t it? In fact, if you add a trend line to the graph, it will be exactly the same as red line: In case of sales, it is appropriate to use SUMX if you deal with temperatures, for example, you will probably use AVERAGEX. Note that to display the correct amount at the grand total level, you also need to modify the RETURN expression. For example, to estimate future sales, you can use dates in place of Measure X, like so: Simple linear regression = You are not limited to using measures for known X and Y values - you can also use columns, thanks to row context being present in SELECTCOLUMNS. Note how we show known weight values when weight is known, but we display estimated weight in case where weight is not known. We can now estimate Dumbledore’s weight and, with a little more DAX, build the following graph: Blue part with your dependent values measure.Green parts with your independent values measure (twice).Red part with your category values column reference.Simple linear regression can be done in just one measure: Simple linear regression = Linear regression has been done in DAX before (by Rob Collie and Greg Deckler, for instance), but my approach uses the new DAX syntax, which makes the calculations very easy.

Note how Dumbledore’s weight is unknown - we are going to predict it with simple linear regression. Let’s say you have the following data model: Name With simple linear regression, you can estimate the quantitative relationship between any two variables.
SIMPLE LINEAR REGRESSION EXCEL UPDATE
Update 2 December 2017: the sales example was updated to display the correct Estimated Sales figure at the grand total level. Note that LINEST and LINESTX allow you to perform multiple linear regression as well! Update 28 February 2023: LINESTX is now used to calculate the slope and intercept. But first, why would you want to do such analysis? The two functions can be used for a simple linear regression analysis, and in this article I am sharing patterns to easily replicate them in DAX. As of 2017, some of the functions, such as SLOPE and INTERCEPT, exist in the latter but not in the former. DAX, originating in Power Pivot, shares many functions with Excel.
