In Power BI, a trend line is a visual tool that represents the general direction or pattern of data over time in a chart, such as a scatter chart, line chart, or bar chart. It’s typically a straight or curved line that best fits the data points, showing the underlying trend of the dataset.
What Does a Trend Line Do in General?
- Highlights Patterns: A trend line helps to identify whether the data is increasing, decreasing, or staying constant over a specific time period or data range.
- Simplifies Complex Data: By focusing on the overall movement, a trend line smoothens out fluctuations and noise in the data, making it easier to understand the direction of trends.
- Forecasting: Trend lines can provide a basis for making predictions about future data points by extending the trend line.
- Correlation Analysis: In scatter plots, a trend line helps to visualize the relationship between two variables, indicating whether they are positively, negatively, or not correlated.
- Performance Measurement: In business analytics, trend lines are used to measure performance over time, such as sales growth, stock prices, or user engagement.
Get the Dataset Here : https://www.kaggle.com/datasets/gurdit559/canada-per-capita-income-single-variable-data-set
How to Use Trend Lines in Power BI
- Create a visual like a scatter plot or line chart with numerical or time-series data.
- Select the visual and go to the Analytics pane.
- Add a Trend Line to the chart.
- Customize it (e.g., change color, transparency, or type like linear or exponential).
Explanation of the Trend Line in the Dataset
A trend line applied to this dataset would highlight the general movement of Canada’s per capita income (in USD) over the years, providing insights into growth, plateaus, or declines. Here’s what the trend line might show:
1. General Trends (1970–2016):
- 1970–1981: Steady upward trend, reflecting a period of economic growth, with per capita income increasing from ~$3,400 to ~$9,400.
- 1982–1992: Slower growth and some dips. Income growth flattens, with minor fluctuations due to factors like the global economic slowdown in the early 1980s and the 1990s recession.
- 1993–2008: Strong upward trend, especially from 2003–2007, as income rises from ~$15,800 to ~$37,400, likely reflecting global economic growth and a booming resource-based economy in Canada.
- 2009: A noticeable dip due to the global financial crisis, reducing per capita income from ~$37,400 to ~$32,700.
- 2010–2013: Recovery, with income peaking at ~$42,600 by 2013, reflecting post-crisis recovery and economic stability.
- 2014–2016: Decline again, with income dropping to ~$34,200 in 2016, potentially reflecting impacts of falling oil prices (a major export for Canada) and economic adjustments.
2. Key Patterns and Insights:
- Strong Economic Growth (1970–1981): The trend line would slope steeply upward, reflecting Canada’s robust economic expansion during this period.
- Recessions and Adjustments:
- Early 1980s: Income growth slowed or plateaued during the global economic downturn.
- Early 1990s: Income dipped briefly, likely tied to the recession in North America.
- 2009: The trend line would show a sharp dip, illustrating the impact of the global financial crisis.
- Post-Recovery Boom (2003–2008): The trend line would rise steeply, showcasing Canada’s economic growth, particularly due to strong performance in the energy and resource sectors.
- Recent Decline (2014–2016): The downward slope at the end reflects economic challenges, including the drop in oil prices and slower economic growth.
What the Trend Line Reveals in Context:
- Growth Phases: The long-term trend is generally upward, reflecting growth in per capita income over 46 years.
- Economic Cycles: Periodic dips in the trend line indicate economic recessions or challenges, such as the early 1980s, early 1990s, and 2009.
- Resource Dependence: The sharp rise in the mid-2000s and subsequent drop in 2014–2016 highlights Canada’s reliance on the energy sector (e.g., oil exports).
- Inflation and Recovery: While nominal income increased, factoring in inflation would provide further insights into real income growth.
Visual Interpretation:
If plotted with a trend line:
- A linear trend line might show an overall upward trajectory, smoothing out shorter-term fluctuations.
- A polynomial trend line (e.g., degree 2 or 3) could better capture the cyclic patterns, including periods of growth, dips, and recoveries.
DAX Formula to Find Slope and Intercept of Trend Line in Power BI
Slope =
DIVIDE(
SUMX(Data, (Data[Year] - AVERAGE(Data[Year])) * (Data[Per Capita Income] - AVERAGE(Data[Per Capita Income]))),
SUMX(Data, (Data[Year] - AVERAGE(Data[Year]))^2)
)
Intercept = AVERAGE(Data[Per Capita Income]) - [Slope] * AVERAGE(Data[Year])