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

by Prathy Kamasani

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 šŸ™‚

You may also like

3 comments

Raul 23 May 2019 - 8:47 am

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.

Reply
Vijay Damale 17 May 2019 - 2:42 pm

This is false blog. This really does not work. Also you have not mentioned formula for measure..

Reply
Dasaradha 13 November 2018 - 4:53 am

Hi Prathy, If possible can you please make YouTube video on “Adding a vertical line or marker to a chart in Power BI”… Thanks

Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More