Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi community,
I'm working with monthly data spanning 25 months in this structure:
month | category1 | category2 | category3 | total_customers
Solved! Go to Solution.
Hi @MattiaFratello , You can make use of the line chart and the default forecast options .
Data :
Line chart :
Setting :
if you need to build a linear regression you can build it using the dax but check before hand whether the data fits the line .
Linear Forecast =
VAR _HistoricalData = FILTER( ALL('CustomerData'), NOT ISBLANK('CustomerData'[Total_Customers]) )
VAR _N = COUNTROWS(_HistoricalData)
VAR _SumX = SUMX(_HistoricalData, INT('CustomerData'[Month]))
VAR _SumY = SUMX(_HistoricalData, 'CustomerData'[Total_Customers])
VAR _SumXY = SUMX(_HistoricalData, INT('CustomerData'[Month]) * 'CustomerData'[Total_Customers])
VAR _SumX2 = SUMX(_HistoricalData, INT('CustomerData'[Month])^2)
// m and b
VAR _Slope = DIVIDE( (_N * _SumXY) - (_SumX * _SumY), (_N * _SumX2) - (_SumX * _SumX) )
VAR _Intercept = DIVIDE( _SumY - (_Slope * _SumX), _N )
// Forecast period
VAR _CurrentDate = INT(MAX('FutureCalendar'[Date]))
// y = mx + b
VAR _Prediction = (_Slope * _CurrentDate) + _Intercept
RETURN
_Prediction
Thanks
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster
Hi @MattiaFratello , You can make use of the line chart and the default forecast options .
Data :
Line chart :
Setting :
if you need to build a linear regression you can build it using the dax but check before hand whether the data fits the line .
Linear Forecast =
VAR _HistoricalData = FILTER( ALL('CustomerData'), NOT ISBLANK('CustomerData'[Total_Customers]) )
VAR _N = COUNTROWS(_HistoricalData)
VAR _SumX = SUMX(_HistoricalData, INT('CustomerData'[Month]))
VAR _SumY = SUMX(_HistoricalData, 'CustomerData'[Total_Customers])
VAR _SumXY = SUMX(_HistoricalData, INT('CustomerData'[Month]) * 'CustomerData'[Total_Customers])
VAR _SumX2 = SUMX(_HistoricalData, INT('CustomerData'[Month])^2)
// m and b
VAR _Slope = DIVIDE( (_N * _SumXY) - (_SumX * _SumY), (_N * _SumX2) - (_SumX * _SumX) )
VAR _Intercept = DIVIDE( _SumY - (_Slope * _SumX), _N )
// Forecast period
VAR _CurrentDate = INT(MAX('FutureCalendar'[Date]))
// y = mx + b
VAR _Prediction = (_Slope * _CurrentDate) + _Intercept
RETURN
_Prediction
Thanks
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |