Forum Discussion
ArchStanton
3 years agoPower Participant
Trendline needed
I have a simple linechart with MonthName on the x-axis (this is derived from my own custom built calendar going from Apr to Mar as per Financial Year) and a DISTINCTCOUNT Measure of IDs for the Y axi...
- 3 years ago
nleuck_101
3 years agoContinued Contributor
The measure should be in your Cases table.
ArchStanton
3 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?- ArchStanton3 years agoPower Participant
I can see Date in your example so I'm assuming that should be my Date2 calendar.
I'm struggling with the ALLSELECTED attributes, I've tried various combinations and nothing works
- nleuck_1013 years agoContinued Contributor
- ArchStanton3 years agoPower Participant
VAR Known = FILTER( SELECTCOLUMNS( ALLSELECTED(Date2[Date]), "Known[X]", Date2[Date] "Known[Y]", [DISTINCT COUNT & SUM] ), AND( NOT(ISBLANK(Known[X])), NOT(ISBLANK(Known[Y])) ) ) VAR SlopeIntercept = LINESTX(Known, Known[Y], Known[X]) VAR Slope = SELECTCOLUMNS(SlopeIntercept, "Slope", [Slope1]) VAR Intercept = SELECTCOLUMNS(SlopeIntercept, "Intercept", [Intercept]) RETURN AVERAGEX( DISTINCT(Date2[Date] Intercept + Slope * Table[Date] )