top of page

Adding a vertical line or marker to a chart in Power BI

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:

Hope this post helps someone out there

Prathy 🙂

 
 
 

Comments


bottom of page