The Power BI line chart is useful for visualizing trends. For example, you can use this to create a sales trend, a temperate trend, and so on. Let me show you how to create a line chart in Power BI with an example.
For this Power BI Line Chart demo, we will use the SQL data source that we created in our previous article. Therefore, see the article Connect Power BI to SQL Server to understand the Power BI data source.
How to create a line chart in Power BI
To create a line chart, first drag and drop the sales amount from the Fields section to the region of the canvas. Automatically create a column chart.
Next, let me add the name of the state province to the Axis section. You can do this by dragging State Province to the Axis section, or just check the State Province column.
By clicking on the line chart below the Display section, automatically converts the Column Chart to Line Chart.
In the following screenshot, you can see the line chart showing the sales trend by state province name.
Create a line chart in Power BI approach 2
First, click on the line chart below the Display section. It will automatically create a line chart with dummy data.
To add data to the Power BI line chart, we have to add the required fields:
- Axis: Specify the name of the column that represents the trend.
- Values: Any numerical value such as sales amount, total sales, etc.
Let me drag the Sales Amount from the Fields section to the Values field and the State Province Name to the Axis section.
Let me sort the data by state province name (by default it's sorted by Sales Amount). To do this, click on the … (3 dots) in the upper right corner and select the Sort by stateProvinceName option.
Now you can see the right Trend
Let me add one more field i.e Total Product Cost to Values section. Compare the trend of the Sales Amount with the Total Cost of the product.
Hover over any position to display the Sales Amount and Total Product Cost tooltip
Let me apply a quick format to this Power BI line chart
NOTE: I suggest that you refer to the article Formatting Line Chart to understand the steps required to format these lines.