Forum Discussion

CH_MJR79's avatar
CH_MJR79
Helper II
2 years ago

How to create a line chart?

Hello all,

I have an Excel data source and am trying to find a way of creating a line chart in Power BI.

 

The data source has a list of account codes, descriptions and columns showing the individual totals for each account code over four years.

 

Creating a line chart in Excel is as easy as selecting the column headings for the x-axis and the Sales totals for the four years as for the y-axis.

 

Can anyone tell me the best way of doing this in Power BI?

 

This is what the Excel data looks like, along with the Excel line chart.

 

 

 

8 Replies

  • Unpivot the data first in power query and then drage the line chart in visual convas and put attribute in x axis and value in Y axis

    • CH_MJR79's avatar
      CH_MJR79
      Helper II

      I've tried that, but it puts the X-Axis attributes vertically instead of horizontall with the line:

       

       

      • mh2587's avatar
        mh2587
        Super User

        Put Attribute on X-axis and Value on Value in field section

  • that's how I've done it. There are four attributes, named Attribute-2020, Attribute-2021, Attribute-2022 and Attribute-2023, along with four values (individual measures) named Sales2020, Sales2021, Sales2022 and Sales2023.

     

    I think it is stacking/showing the values in a vertical line because the Attribute fields aren't date/time fields (they are not supposed to be).