Forum Discussion
Reference Line on x-axis
I have date on my x-axis of a Line chart.
I need a vertical reference line on a particular (dynamic) date to see if my trend line crossed that date or not.
Thanks.
Hi naitiksoni
To draw the Vertical reference line is currently not possible. You can use bit of trick though. Use Shapes to create a static vertical line and it is not dynamic as explained. See the attached screenshot.
Hi naitiksoni,
A vertical reference line is not available now. To work around this requirement, you can try to use a combination chart.
- Create a "line and stacked column chart"
- Put column [date] into shared axis and put [values] into line values.
- Create a measure that evaluates to the maximum value when Date=specific date(otherwise blank), put this measure into column values.
Measures can be:
Reference line = IF ( HASONEVALUE ( Table1[Date] ), IF ( VALUES ( Table1[Date] ) = DATE ( 2016, 3, 1 ), MAXX ( ALL ( Table1[Date] ), MAX ( Table1[Sales] ) ) ) )Thanks,
Yuliana Gu
16 Replies
- v-yulgu-msftMicrosoft Employee
Hi naitiksoni,
A vertical reference line is not available now. To work around this requirement, you can try to use a combination chart.
- Create a "line and stacked column chart"
- Put column [date] into shared axis and put [values] into line values.
- Create a measure that evaluates to the maximum value when Date=specific date(otherwise blank), put this measure into column values.
Measures can be:
Reference line = IF ( HASONEVALUE ( Table1[Date] ), IF ( VALUES ( Table1[Date] ) = DATE ( 2016, 3, 1 ), MAXX ( ALL ( Table1[Date] ), MAX ( Table1[Sales] ) ) ) )Thanks,
Yuliana Gu- BhaveshPatelSuper UserIt's lovely. Thanks Yuliana
- naitiksoniRegular Visitor
- pschommerHelper II
Thank you for providing this helpful solution to a similar problem I've had!
I implelemented it and it works as expected. Your screen shot, however, shows a very thin line (which I like) while mine is quite thick. I can't seem to find any formatting option that controls the width of the column(s).
Am I missing something? Can you please point me to this option?
- BhaveshPatelSuper User
Hi naitiksoni
To draw the Vertical reference line is currently not possible. You can use bit of trick though. Use Shapes to create a static vertical line and it is not dynamic as explained. See the attached screenshot.
- sundayDriverMicrosoft Employee
As an FYI here is a related idea to vote for:https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/19550122-vertical-reference-lines-on-the-x-axis