Forum Discussion
Reference Line on x-axis
- 9 years ago
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.
- 9 years ago
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
I have a project with Production deployed to date, for this project, there are Incidents associated with it and for each incident, there is created date. My requirement is, I have to plot count of incidents based on their create date on X-Axis. But the challenge here is I have to include a vertical line on X-Axis based on Production deployed to date so that user will quickly identify when the project is deployed on production and he can quickly check how many incidents are raised before one month and after one month. Please help me know how can I achieve this.
Not sure if the issue is still open or not, but I recently had to tackle a similar issue. I saw that there was a way to use a combo chart to create the reference line with a measure, but you can't split your line chart into multiple categories with the combo chart, so that didn't meet my needs.
The best way I found to have a dynamic reference line was to overlap multiple visuals on top of each other.
- Create your line chart like normal with no reference line
- Create a measure with the basic equation below (assuming you're plotting by date):
- if(datevalue(max(<date on your x-axis>)) = Date(<event date>),1,0)
- My report required the user to input a desired event date. So I used parameters for Day, Month, and Year:<event date> above = Date('Year'[Year Value],'Month'[Month Value],'Day'[Day Value])
- Copy and paste your line chart, convert it to a column chart, and put your new measure into the "column values" pill
- Move your column chart directly behind your line chart, and make everything on the chart except for your column color white (axis, title, etc.)
- Now you should have a dynamic reference line! The only problem is that the axes of the two charts are not aligned
- To get around the axes being unsynced, I turned off the y-axis completely of both charts, so that differences in their scale would no longer change the aspect ratio of the chart
- I then created a 3RD CHART that is yet another copy of the line chart. Here, I made everything white except for the y axis, including the data colors. That way we now have a y-axis that follows our filters, but does not affect the aspect ratio of the charts that is actually show our data and the reference line
The only downfall of this method is that, if you have new categories come into your data later, you will have to go back into your 3rd chart and make those new categories white.
Hope this helps!