powerbitime-serieslinecharttimeserieschart

How do I prevent Power BI line chart drawing a line through time series points when there is no value for some intervals?


I have created a line chart in Power BI to visualise the following fictional data.

**LA Year Value**
WF 2020 4
WF 2021 10
WF 2022
Hac 2020 6
Hac 2021 23
Hac 2022 28
Har 2020 3
Har 2021 8
Har 2022 10
Hac 2023 11
WF 2023 12
Har 2023 5

As you can see in the third row, there is no value for WF in 2022 but further down WF has a value of 12 in 2023. When I plot WF values by year and also national average values, Power BI draws a straight line for WF from 2021 (10) through 2022 to 2023(12). However, I do not want a line to be drawn through 2022 if a value does not exist. I just want the line to stop at 2021 and plot a dot for the 2023 value.

Line chart plot of above data in Power BI

Can anyone help with this please?

I have tried changing the x axis from continuous to categorical but that did not make a difference.


Solution

  • I have managed to resolve this with a bit of digging around. I was able to plot a broken line but doing the following.

    1. Change the x-axis from continuous to categorical. (Ensure that the Year is a number and not text).

    2. Then right click on the visual and sort by Year.

    The line between the 2021 value and the 2023 value will disappear and a single point will be plotted for 2023 value. That's it! Hopefully this will be useful to someone.