Geir Forsmo
Geir Forsmo

Reputation: 149

How to visualize multiple lines from two measures

I have a challenge in Power BI Desktop to model and display a line chart that shows multiple lines in the same visualization where the x,y pair consists of two measures. The X axis contains a measure Average weight and the y axis Price per Kilo. There is a Normal line chart displaying the optimal curve where as there are a number of projects displaying other curves in the same chart (as legends). Below you see the coordinates for the normal curve, while the project curves can have other x,y values. This is easy in Excel but not that easy in Power BI.

To make lines it seems that every x coordinate in Line chart must be in the same interval. Otherwise I only get points not separate lines. Maybe the line chart component is not suitable for showing this. I think scatter chart is more suitable but I don't think it can show lines between the points.

I hope some of you have solved this or may be have pbix file to share how this have been solved.

Regards Geir

Sample data:

| Avg weight | Price pr kg |
|------------|-------------|
| 100        | 129.39      |
| 500        | 63.65       |
| 1000       | 40.13       |
| 1500       | 33.41       |
| 2000       | 30.05       |
| 2500       | 27.53       |
| 3000       | 25.43       |
| 3500       | 23.582      |
| 4000       | 22.91       |
| 4500       | 22.322      |
| 5000       | 21.902      |
| 5500       | 21.734      |
| 6000       | 21.65       |

Plot example:

enter image description here

Upvotes: 1

Views: 1635

Answers (1)

Mike Honey
Mike Honey

Reputation: 15037

This is seems quite straightforward, although perhaps your actual data is more complex?

With Avg Weight and 2 data series in one Table, I can use Avg Weight as the X Axis and the 2 data series as Values to achieve something similar to your requirement:

Screen shot of Line Chart

Upvotes: 0

Related Questions