Forum Discussion

jkfe's avatar
jkfe
Frequent Visitor
2 years ago

How to create a line chart without aggregation?

I want to create a line chart that has two lines and a single dot.

 

This is the data.

 

Line 1

X1Y1
102
113
124
135
146
157
1510

 

 

Line 2

X2Y2
101
112
123
134
145
156
156

 

 

Single dot

XdotYdot
125

 

It should look like this (as created in excel):

 

 


But in Power BI whenever I drag a value to the Y-axis (Visualizations pane) it wants to do an aggregation (sum, count...).

 

But I just want to plot the (x, y) coordinates without aggregation and create the lines as in the above example.

 

How to do that?

4 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    Yes it's possible.

    Put all the co-ordinates in one table, call the columns x and y.  Add a column to differentiate the 3 sets of data.

    So it will look like this:

    x   y  set

    10 2 a

    11 3 a

    more rows

    ..

    10 1 b

    11 2 b

    more rows

    ..

    12 5 c

     

    --

    Then plot this in the line chart with   'set' in Legend

    --

    Please note, the line chart requires an aggregation on the y-axis. That's how it works.

    • jkfe's avatar
      jkfe
      Frequent Visitor

      Hi HotChilli,

       

      Thanks for the answer.

       

      Unfortunatly it didn't quite work.

       

      Reason is I need to be able to have more than one Y value for the same X value.

       

      If you see my dataset it has these two values for line a: (15, 7) and (15, 10).

      And these other two for line b: (15, 6) and (15, 6) again (two times same value pair).

       

      So for line A it needs to plot those two coordinates and make a line from one to the other (see sample chart I posted when opened this question in the forum). 

       

      Instead, it is summing the Y axis and ploting (15, 17) which is incorrect.

       

      And for line B it should plot the same plot (15, 6) twice (which will really make it just one plot on the chart). But instead it is summing it up plotting (15, 12) which is also incorrect.

       

      See the results on chart below to compare with original chart I posted.

       

       

      That is why in the question I asked is how to do it without aggregation as this is the exact problem I was already facing.

       

      Thanks.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi,

        Thanks for the solution HotChilli  provided and i want to offer some more information for user to refer to.

        hello jkfe , in Power BI Desktop, the y-axis cannot show the value, you can consider to try the following alternatives.

        Change the table to the following format.

        Then put the following field to the line chart.

        Output

         

        Best Regards!

        Yolo Zhu

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.