Forum Discussion
Scatter Plot with EWMA Line
- 8 months ago
Hi rehansaeed2468 ,
Power BI doesn’t have a native EWMA option, but you can achieve this by creating a DAX measure to calculate the EWMA values. Once the measure is created, you can use it in the Analytics (Advanced analytics) section of the scatter plot to display the EWMA as a line. - 8 months ago
Power BI doesn’t support EWMA (or any other moving-average / trend line) natively in a scatter chart, so there’s no built-in switch for this.
If you still want to show an EWMA line, you basically have three options.
The first option is to calculate EWMA as a DAX measure and plot it together with your original measure in the same scatter chart.
This works, but it’s important to understand the trade-offs: the calculation is relatively heavy, it requires a proper calendar table, and it’s suitable mainly for visualization purposes (not for detailed analysis).A simplified example of an EWMA measure:
EWMA :=
VAR Alpha = 0.3
VAR CurrentDate =
MAX ( 'Calendar'[Date] )VAR DatesUpToCurrent =
FILTER (
ALL ( 'Calendar'[Date] ),
'Calendar'[Date] <= CurrentDate
)VAR WeightedTable =
ADDCOLUMNS (
DatesUpToCurrent,
"t",
RANKX (
DatesUpToCurrent,
'Calendar'[Date],
,
DESC
),
"Value", [Value]
)VAR Numerator =
SUMX (
WeightedTable,
[Value] * Alpha * POWER ( 1 - Alpha, [t] - 1 )
)VAR Denominator =
SUMX (
WeightedTable,
Alpha * POWER ( 1 - Alpha, [t] - 1 )
)RETURN
DIVIDE ( Numerator, Denominator )
The second option is to reconsider the visual itself.
If your X-axis is Month-Year and your Y-axis is a single KPI, you’re effectively working with a time series. In that case, a line chart is usually the more appropriate choice and will make an EWMA line much easier to read, explain, and maintain.The third option is to pre-calculate EWMA outside Power BI (SQL, Power Query, Python/R) and then load it as a regular column. From both a performance and modeling perspective, this is often the cleanest solution, especially for long time series or production-grade reports.
One important note: if the scatter chart is only being used to show values over time, it doesn’t really add analytical value and mostly introduces limitations. In many cases, switching to a line chart is not a compromise — it’s the correct modeling decision.
Hi rehansaeed2468 , Hope you're doing okay! May we know if it worked for you, or are you still experiencing difficulties? Let us know — your feedback can really help others in the same situation.