Working with Line Charts
- 04:11
Working with Line Charts
Transcript
Working with Line Charts Line charts are a great visual to show trends over a period of time.
They will take a single value or a single column and plot that over a period of time. So it might be years months days or quarters and allows us to see the fluctuation the peaks and the troughs of the data. We can even compare several values we can add a legend field in and that will allow us to break that total down into maybe two or three different groups.
Sometimes with a line chart we need to plot what's called a secondary axis. This is because if we use two columns of data and the values for each of those columns is a little different. So perhaps one of them uses numbers that are maybe in the thousands and the other one uses values which remember just low hundreds. It's very difficult to see one of those lines so we'll have to plot it on its own axes and so we need to use a secondary axis.
Let's do a workout and see how to do that in Power BI.
I'm going to just choose Get Data, I'm going to my Excel workbook module 5 lesson 1C.
Now in this particular workbook I will have two worksheets. I'm going to take both of them here the commodities and the credit transactions and load them both in.
So I'll start by using the credit transactions data sets. So if I just go over to my field list here and I'm going to just create a line chart to show me the total amount over a period of time. I'll select my date field and I've just taken the full hierarchy there and click on amount and I'll turn it into a line chart. So we have several years of data here and we can see the line chart very clearly. Lets us see the the fluctuation across that period of time.
If we want to we can bring in another way to group the data, so I have a category field and I would place that in here underneath the visualizations icons as a legend. I'm just going to drag it in myself just down as a legend field and it takes my total and breaks it into three different values, one for entertainment, one for home, and one for travel. So again, I can compare each one there in the line chart and see the pattern and trend over that period of time.
One more example. So if I just go to a second page here, I'm going to take the commodities data.
Again, it's got a date column and it's got the price of gold, and the price of silver. I'm just going to click on the date field as I have before and I'll take gold first of all, and I'll turn it into a line chart.
Now slight problem here and we'll often find this when we're dealing with data such as this where although we have the date hierarchy and it's great in lots of instances, it has summarized the data for us by year. Now, what I really want to do is remove that summary, I'm not interested here in using the hierarchy at all. I would like to see what my price of gold is for every single day, if you imagine every row on the spreadsheet, I want those dates plotted and it will give me a much much better idea of the fluctuation.
In this particular example, I'm going to go down here and I'm not going to x out the values from the hierarchy, I'm going to remove it completely. Always default to using the hierarchy. That's the name of my field there date,, so I'm gonna take the hierarchy off and just click on date. There we go much much easier to see the fluctuation across that period of time. I'm going to add in another column I'm going to add in silver so I can compare it and all of a sudden the lines don't look too great And that's because the values for silver are so much smaller than the values for gold. So I'm going to plot silver on its own axis. I just scroll down here.
I will drag silver in as a secondary axis. There we go, much much easier to make sense of the chart now.