Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am using the October download of PBI.
I can add a trendline for scattered plot and a line chart.
However, I cannot find the option to add the formula (just like in Excel).
Any idea?
Thanks,
Tamir
Solved! Go to Solution.
Someone lese asked for it in May - see the comments on https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/6998768-ability-to-add-trend-line...
You can likely do it in R until/if that feature is implemented in native Power BI visuals - e.g. http://stackoverflow.com/questions/24882209/how-to-get-trendline-equations-in-r
Hi there,
this function replicates the Excel-Trend-function, just without the possiblity to define your own slope and intercept:
(YList as list, NoOfIntervalls as number) => let Source = Table.FromColumns({YList}), xAxis = Table.AddIndexColumn(Source, "Index", 1, 1), Rename1 = Table.RenameColumns(xAxis,{{"Column1", "y"}, {"Index", "x"}}), AvgX = List.Average(Rename1[x]), AvgY = List.Average(Rename1[y]), x = Table.AddColumn(Rename1, "xX", each [x]-List.Average(Rename1[x])), y = Table.AddColumn(x, "yY", each [y]-List.Average(x[y])), xy = Table.AddColumn(y, "xy", each [xX]*[yY]), xXx = Table.AddColumn(xy, "xXx", each [xX]*[xX]), a = List.Sum(xXx[xy])/List.Sum(xXx[xXx]), b = AvgY-(a*AvgX), ListIntervalls = {List.Max(Rename1[x])+1..List.Max(Rename1[x])+NoOfIntervalls}, TableIntervalls = Table.FromList(ListIntervalls, Splitter.SplitByNothing(), null, null, ExtraValues.Error), Rename = Table.RenameColumns(TableIntervalls,{{"Column1", "x"}}), Values = Table.AddColumn(Rename, "y", each [x]*a+b), TREND = Table.Combine({Rename1,Values}) in TREND
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @Anonymous
As of now, there is no native format option that will give you the regression summary output (Y intercept, slope, R^2, ect.)
You can write some DAX to derive the equation or you can download the 'Craydec Regression Chart' visual from BPI marketplace. This visual will give you the equation (Y= MX + B), R^2, and other regression output data.
Obviously, you can also export your data set to Excel to do the complete regression analysis (P-value, T-test, F-score, std error, and much more).
I hope this helps!
-Eric
This is simple linear regression. Also, I did not figure this out, but it has been so long that I don't remember where I got it. When I find the guy's name, I'll credit him here.
Just replace your dates (colored blue), and the measure of interest (colored red).
This is a great solution and the code can be found here: https://xxlbi.com/blog/simple-linear-regression-in-dax/
I would really appreciate it if someone could tell me how to display the slope.
Thanks for sharing, do you know how we could amend this to be dynamic and account for filtered data either in a table or in an actual visual. We are aggregating data at a product level and would like for the calculated trend to represent the selected product.
As far as I know, there is no possibility to specify a formula for the trend line.
In the most recent version there is a possibility to add different kinds of lines. Would one of these fit your needs?
Hi Markus,
I need the formula for predictions...
I posted a suggestion in the Ideas section.
Someone lese asked for it in May - see the comments on https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/6998768-ability-to-add-trend-line...
You can likely do it in R until/if that feature is implemented in native Power BI visuals - e.g. http://stackoverflow.com/questions/24882209/how-to-get-trendline-equations-in-r
Hi there,
this function replicates the Excel-Trend-function, just without the possiblity to define your own slope and intercept:
(YList as list, NoOfIntervalls as number) => let Source = Table.FromColumns({YList}), xAxis = Table.AddIndexColumn(Source, "Index", 1, 1), Rename1 = Table.RenameColumns(xAxis,{{"Column1", "y"}, {"Index", "x"}}), AvgX = List.Average(Rename1[x]), AvgY = List.Average(Rename1[y]), x = Table.AddColumn(Rename1, "xX", each [x]-List.Average(Rename1[x])), y = Table.AddColumn(x, "yY", each [y]-List.Average(x[y])), xy = Table.AddColumn(y, "xy", each [xX]*[yY]), xXx = Table.AddColumn(xy, "xXx", each [xX]*[xX]), a = List.Sum(xXx[xy])/List.Sum(xXx[xXx]), b = AvgY-(a*AvgX), ListIntervalls = {List.Max(Rename1[x])+1..List.Max(Rename1[x])+NoOfIntervalls}, TableIntervalls = Table.FromList(ListIntervalls, Splitter.SplitByNothing(), null, null, ExtraValues.Error), Rename = Table.RenameColumns(TableIntervalls,{{"Column1", "x"}}), Values = Table.AddColumn(Rename, "y", each [x]*a+b), TREND = Table.Combine({Rename1,Values}) in TREND
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ImkeF
when I go to power query and enter a blank table then put in this code it comes up to an entry screen where I can put in one column reference. Is there a way to enter the x and y? I want the trend for x against y similar to a trendline in a scatterplot?
Sorry, but I don't understand your question.
If your values that form the basis of the trend don't exist in a table already, you can enter them under "Enter data" and reference that table instead.
All this function does is to create a table with x and y -values for the desired count of future periods and it has nothing to do with the visualisation itself.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Sorry if I was unclear. I have this on my screen. When I go to choose column, it only allows me to pick one column (x). How do I give it the y-axis? I was thinking that I select one column for x and one for y. I want the x to be UR and the y to be ASA trend.
Thanks, now I understand. My solution creates a Y-axis and an index starting as 1. So when you add an index starting at 1 to your original table, you can merge those tables back together on it after that.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi ImkeF,
I am a newbie with Power BI and I don't understand where do we have to implement your formula :
There :
Or there :
And in wich language is your formule : M or DAX ?
Thanks for your understanding
Best regards
copy the code and paste it into the advanced editor of the query editor:
You might also find this video helpful:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Are there other introductory resources for M language, functions, etc.? It can be useful but simple examples are needed ...
copy the code and paste it into the advanced editor of the query editor:
You might also find this video helpful:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi ImkeF,
I am a newbie with Power BI and I don't understand where do we have to implement your formula :
There :
Or there :
And in wich language is your formule : M or DAX ?
Thanks for your understanding
Best regards
Thank you.
I guess it answers my question....
I still have to work out how to implement the solution 🙂
Tamir
I am using the trend-line, useful. But I can't find how to see the values of the line (the trend-line), how can I do ??
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |