Forum Discussion
Ethanhunt123
Helper IV
2 years agoLINESTX with slicer
Hello, I am trying to calculate trends using slope and intercept I am using the following DAX, which is functioning well. However, the issue arises when I have a slicer on the order date. I...
- 2 years ago
Ethanhunt123 Hi! Try with:
Revenue trend =
VAR line =
LINESTX (
ALLSELECTED('Sales order line fact'[Order date]), -- This respects the slicer
[Total revenue trend],
'Sales order line fact'[Order date]
)
VAR slope = SELECTCOLUMNS(line, [Slope1])
VAR intercept = SELECTCOLUMNS(line, [Intercept])
VAR x = SELECTEDVALUE('Sales order line fact'[Order date])
VAR y = x * slope + intercept
RETURN yBBF
Ethanhunt123
Helper IV
2 years agoI was doing something incorrectly. Your solution worked perfectly. Thank you so much! 🙂