Forum Discussion
Trendline needed
- 3 years ago
ArchStanton
Maybe try creating a new measure. Now for the return part you may want to change yours to COUNTX or SUMX depending on what your wanting your results to be. I used AVERAGEX for my example. LINEST AND LINESTX are new to Power BI from their Power BI Desktop update in February I believe. They can be used to create a simple linear regression line or trend line.
Simple Linear Regression =
Thanks!
Apologies for the daft sounding question, where should I be writing this measure?
I have a customised Date Calendar called Date 2 which is linked to a Table called Cases (thats what I'm counting the no of text IDs of).
I'm trying to substitute your code with my data fields, can you help me with this?
Simple Linear Regression =
- nleuck_1013 years agoContinued Contributor
The measure should be in your Cases table.
- ArchStanton3 years agoPower Participant
Hi Sorry about this, my DISTINCTCOUNT of IDs is derived from the 'Cases' table but I'm
struggling to substitute your Values e.g. Known [X] & [Y] etc with my actual table names
My Date table is called Date2.
Can you tell what belongs where please?
Much appreciated
- nleuck_1013 years agoContinued Contributor
ArchStanton
Your Known[X] & [Y] become the new names of the fields. You don't need to substitute anything else. For example:VAR SlopeIntercept =LINESTX(Known, Known[Y], Known[X])You do not need to replace Known[Y] or Known[X] with anything. You've already identified them earlier in the VAR Known.
Does that make sense? Are you receiving an error?