A business user came to me asking “how can I get a vertical line on Line Chart in Power BI like my Excel report?”. I was like, “Itās straightforward. We have this analytics pane which lets you add so many types of lines š “. But, quite quickly I understood, I cannot draw a vertical line as we do in Excel or SSRS.
Adding a vertical line or marker to a chart in Power BI
Data looks like below:
The user wants a marker, ideally a line to point those events on the chart. I cannot think of an out the box option, but there are some workarounds. Let’s look at adding a line using Combo Chart. This chart clearly shows events as bars and tooltips can define what kind of event it was. I would prefer to change the bar width. Itās a bar; itās not exactly a line; however, it fits for the purpose.
Next using Markers:
With latest Power BI update, we can set line stroke width to zero. So I decided to use that feature to highlight the events on the chart. Itās a simple Line Chart with one axis and two values. One value is to show the Value column and other to show Count of Event. My chart looks like this:
Then I updated X Axis type to Categorical (Otherwise, Markers functionality will not be available). Then under Shapes, set Show marker to On, followed by Customize series option to On. Then I turned off marker for Value column, On for Count of Event.
Then I decreased Stoke width to 0 and increased Marker size to 16. Now the chart looks like this:
Tooltip donāt make much sense, but by using new report tool tip pages functionality we can have much more helpful and user-friendly tooltip like below:
3 comments
Hi Prathy,
Thanks a lot for this post. It’s exactly what I was looking for. However, I haven’t been able to customize the shapes of the columns. I simply don’t have the option to toggle between line and column within the shapes section. I can only configure the settings for lines. I actually opened this thread in power bi forums but I the solution they suggested is more like a work around rather than a solution and does not even work properly.
thanks again.
This is false blog. This really does not work. Also you have not mentioned formula for measure..
Hi Prathy, If possible can you please make YouTube video on “Adding a vertical line or marker to a chart in Power BI”… Thanks