Forum Discussion
Data Labels Position Line chart
Hi All,
So, we are using a line chart to show a yearly trend.
2025 and 2026 are the 2 lines which we are plotting in the line chart.
There is an issue in the position of data labels.
BLUE LINE->2026
GREY LINE->2025
The requirement is that lower values should come below the line and higher value should come above the line.
For example, let's consider Week 2 ,27.7 should come below and 29.2 should come above the line.
To keep it simple, it should be opposite to how it is shown in this picture.
I can achieve this by adjusting data label position, I can keep 2026 line as Under and 2025 as Above.
But, then if we consider Week 5, the value of 2026 is more than 2025 in this week.
Since I have kept 2026 as under, 42.3 will come below and 39.8 will come above.
I have tried all combinations in modifying the data labels position and I have tried Auto position as well.
Atleast in one of the weeks, the label position always gets misplaced.
Any suggestions on this?
| 2025 | 2026 | |
| Week 1-> | 21.4 | 15.8 |
| Week 2-> | 29.2 | 27.7 |
| Week 3-> | 34.2 | 33.6 |
| Week 4-> | 36.7 | 38.2 |
| Week 5-> | 39.8 | 42.3 |
Hi Imagauthamam
The only way I can think of to tackle this is to create a generalised "Year" dimension that branches off from the 'Date' table (assuming you have one), which includes special values "High" and "Low".
- Year[Year Label Display] is used as the legend field (effecitvely hiding values that do not represent actual years).
- When Year[Year Label] represents an actual year, the original value is plotted on the chart.
- When Year[Year Label] = "High", the max value (adjusted upwards slightly) is plotted.
- When Year[Year Label] = "Low", the min value (adjusted downwards slightly) is plotted.
- The High/Low are just there to display data labels from a specially constructed measure Value Data Label.
- These data labels can be coloured using a measure Data Label Colour which selects a colour corresponding to the relevant line.
I'll let you look through the PBIX, but the end result looks like this.
This solution is rather fiddly to set up and it likely needs adjusting to work in all scenarios. I'm not sure if it's worth the effort to be honest. I wish that the core line chart made this sort of label positioning easier!
There might also be something creative you could do with visual calculations 🙂
Regards
4 Replies
- OwenAugerSuper User
Hi Imagauthamam
The only way I can think of to tackle this is to create a generalised "Year" dimension that branches off from the 'Date' table (assuming you have one), which includes special values "High" and "Low".
- Year[Year Label Display] is used as the legend field (effecitvely hiding values that do not represent actual years).
- When Year[Year Label] represents an actual year, the original value is plotted on the chart.
- When Year[Year Label] = "High", the max value (adjusted upwards slightly) is plotted.
- When Year[Year Label] = "Low", the min value (adjusted downwards slightly) is plotted.
- The High/Low are just there to display data labels from a specially constructed measure Value Data Label.
- These data labels can be coloured using a measure Data Label Colour which selects a colour corresponding to the relevant line.
I'll let you look through the PBIX, but the end result looks like this.
This solution is rather fiddly to set up and it likely needs adjusting to work in all scenarios. I'm not sure if it's worth the effort to be honest. I wish that the core line chart made this sort of label positioning easier!
There might also be something creative you could do with visual calculations 🙂
Regards
- ImagauthamamHelper III
Thanks OwenAuger for coming up on this.
As you rightly pointed out, this might need adjustments in certain situations.
Power BI should work to develop something on this
- amitchandakSuper User
Imagauthamam , In the Latest version of Power BI. You can choose each series under the label and change its position under options
- ImagauthamamHelper III
Hi amitchandak ,
I have the current version. The reason your graph works is that your line charts are separate and do not overlap. Therefore, the above and Under option will work for you. However, in my case, the 2026 line is high in some weeks, while the 2025 line is high in other weeks. The offset options also doesn't help much in my case