In this Power bi tutorial, we will learn What is Power Bi line chart, how to create a line chart in Power BI, and also we will learn
- How to create a power Bi line chart?
- Power Bi line chart month and year
- Power Bi line chart multiple lines
- Power Bi line chart multiple values
- Power Bi line chart show zero values
- Power Bi line chart marker color based on the value
- Power Bi line chart secondary value
- Power Bi line chart secondary axis
What is Power Bi line chart?
In Power Bi line chart is a series of data points represented by dots, connected by a straight line.
Line chart in power bi having one or many lines. It is having an X-axis and Y-axis. In Power Bi, the line chart is usually used to visualize data over time.
Read: How to create Power BI report from SharePoint list and Power Bi Bar Chart.
How to create a Power Bi Line chart?
Here we will see how to create a line chart in power bi desktop.
- Open your Power Bi desktop
- Upload data from the Get Data in Power Bi. Here we are using the Sales Data. and you can download the data from here.
- Go to the report on Power bi desktop.
- Then select a line chart from the visualization pane
- Then in the field formatting section in the visualization pane, under Axis select the Date->Month, and in the value-> Sales.
Now you can see the Line chart visualization in Power BI on the basis of Sales by month.
This is how to create a Power Bi Line chart.
Read: Power BI Pie Chart
Power Bi line chart month and year
Here we will see how to create line chart visualization using month and year in Power Bi. We will use the above data to create line chart visualization.
To create a line chart visualization, open the Power bi Desktop and load the data. Then
- Select the Line Chart, from the visualization in Power Bi.
- From the Fields formatting section, drag the Order Date and put it on the Axis.
- Then from the Date hierarchy select the Year and Month in the Field pane.
- In the value field, Select the units delivered from the Fields pane.
- Then go to Format Tab, Click on the X-axis.
- The X-axis is divided into two types
- Continuous: The Continuous axis is only applicable to numeric Data, like date and time. If we are using a continuous axis, then we don’t have control over the scale, which means if we are extending the date range or increasing the size of the chart, the scale automatically adjusts.
- Categorical: The Categorical axis can use text or number, and also it levels every data point.
- Select the Continuous X-axis under the Type.
- Now click on the Fork icon present at the top of the Line chart visualization in the Power bi.
- By clicking on the Fork icon, it will take one level down in the hierarchy.
- That means here in the date hierarchy, it will first show the year, as we select the month and year for this visualization, once you click, it will go one level down in the date hierarchy and it will show month and year in the X-axis.
Now you can see the Power Bi line chart month and year having continuous X-axis.
- Now we will see the Power Bi line chart month and year having categorical X-axis.
- In the visualization pane-> Format section->X-axis-> Type-> Categorical.
- In the below screenshot, you can see the Power Bi line chart month and year having categorical X-axis.
Read: How to Embed Power BI Report in SharePoint Online
Power Bi line chart multiple lines
Now we will see how to add multiple lines to Power Bi line chart using the above data.
- Select the Power Bi Line chart from the visualization.
- Then follow the above Power Bi line chart month and year to add the Date to the X-axis.
- Then in the value -> profit and units delivered. This will show two lines one for the profit and another for the units delivered. Also, you can add more values in the value field to display the multiple lines in a line chart.
Now you can see the Power bi Line chart multiple lines based on profit and unit delivered by year and month.
Read: How to Create a Dashboard in Power Bi?
Power Bi line chart multiple values
Here we will see how to add multiple values in line chart by using the above data.
- Select the line chart from the visualization.
- As we do in the power Bi multiple lines, in the same way, we will add multiple values i.e Units Delivered, profit, and discount -> value and order date -> Axis.
- Now you can see the Power Bi line chart multiple values based on units delivered, profit, and discounts by Month.
Power Bi line chart show zero values
Here we will see, how to show zero value in Power Bi line chart using the above data set.
- Select the Line chart from the Visualization in Power Bi.
- We will use the Product name -> Axis field and the Discount -> value field.
- In the discount data column in the excel sheet, no data means “null” and zero means 0.
- Now you can see the line chart when the X-axis is categorical.
In the above screenshot, zero value is not shown in the Y-axis.
To solve this problem we will create a measure i.e.
Total discount = IF(ISBLANK(SUM(Sales_Table[Discount])),0,SUM(Sales_Table[Discount]))
According to your data, you can change your measure.
Then change the value field-> total discount.
After applying the measure, now you can see the zero value shown in the Y-axis of the Power Bi line chart.
Read: Microsoft Power bi report vs dashboard
Power Bi line chart marker color based on value
Here we will see how to create a Power Bi line chart marker color based on value by using the above excel data.
There is no straightforward option to create the Power Bi line chart marker color based on the value, we can do that by using the stacked column chart conditional formatting.
- Select stacked column chart from the visualization pane in Power Bi.
- Select the order date -> Axis and Quantity -> value in the field section.
- Select the Format -> Data colors in the visualization pane.
- Then click on the fx icon in the Default color section to apply conditional formatting.
- Under Format by, select Rules.
- Under Based on Field, Select the Quantity.
- Then we will add rules to format the data colors in a stacked column chart visualization
- If the value is greater than 0 and is less than 80, then select a color from the color pane.
- Click on the New Rule to add another rule.
- If the value is greater than 20 and less than 80, then select a color from the color pane.
- Click on OK.
Now you can see marker color based on the value in stacked column chart.
Now convert the stacked column chart into Line chart.
In the below screenshot you can see the Power BI line chart marker color based on the value.
Power Bi line chart secondary value
Here we will see how to get Power Bi line chart secondary value.
- Click on the line chart from the visualization pane in Power bi desktop
- In the Field format section, Axis-> Order date, value-> Quantity, Secondary values-> profit.
- Now you can see the power bi line chart secondary value in right side if the Y-axis
Read: How to create Power BI report from SharePoint list
Power Bi line chart secondary axis
Here we will see about the Power Bi line chart secondary axis.
- Click on the line chart from the visualization pane in Power bi desktop.
- In the Field format section in visualization pane, Order date->Axis, Quantity-> values, and profit->Secondary values.
- Then in the Format section in turn on the secondary axis.
- In the secondary axis setting, you can set the start range and end range
- Then we can set the Scale type
- You can set the color, text size, and font family of the Secondary axis.
- You can set the display units of the secondary axis.
- Under the Title section, you can set the title of the secondary axis
- Under Style, you can set the style the title of the secondary axis.
- You can set the Title color, Axis title, title color, title text size, and title font family.
Now you can see the Power Bi line chart secondary axis based on Quantity and Profit by year and month.
You may also like:
- How to combine multiple files from SharePoint folder in Power BI
- Power Bi Pyramid chart – How to use
- How to embed Power bi report in PowerApps portal
- How to display Power bi google analytics in PowerApps
- Power BI: How to Connect Most Recent File from a Folder
- Publish to Web Power BI Error: Contact Your Admin to Enable Embed Code Creation
- Power bi area chart
- Power BI waterfall chart
In this Power Bi tutorial, we learned What is Power Bi line chart. And also we discussed how to create a Power Bi line chart?
By using the sample data we created:
- Power Bi line chart month and year
- Power Bi line chart multiple lines
- Power Bi line chart multiple values
- Power Bi line chart multiple values and legend
- Power Bi line chart show zero values
- Power Bi line chart marker color based on the value
- Power Bi line chart secondary value
- Power Bi line chart secondary axis
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.