cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sundayDriver Regular Visitor
Regular Visitor

Re: Reference Line on x-axis

Matt22365 Member
Member

Re: Reference Line on x-axis

Hi

 

I know this is an old but did you manage to fiure our how to make the column thinner? Ive tried the padding but it doesnt change it enough for what I would like

 

Thanks

 

Matt

Re: Reference Line on x-axis

Is there a way to get multiple vertical reference lines?

 

I tried this,

 

Reference line =
IF (
HASONEVALUE( Query1[datetime] ),
IF (
VALUES ( Query1[datetime] ) = DATESBETWEEN(Query2[DATE], DATE(2018,1,1), DATE(2018,12,31)),
MAXX ( ALL ( Query1[datetime] ), MAX ( Query1[param1] ) )
)
)

I get further error,

 

Error Message:

MdxScript(Model) (7, 43) Calculation error in measure 'Query1'[Reference line]: A table of multiple values was supplied where a single value was expected.

 

Highlighted
elocke Frequent Visitor
Frequent Visitor

Re: Reference Line on x-axis

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.

  1. Create your line chart like normal with no reference line
  2. Create a measure with the basic equation below (assuming you're plotting by date):
    1. if(datevalue(max(<date on your x-axis>)) = Date(<event date>),1,0)
       
    2. 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])
  3. Copy and paste your line chart, convert it to a column chart, and put your new measure into the "column values" pill
  4. Move your column chart directly behind your line chart, and make everything on the chart except for your column color white (axis, title, etc.)
     
  5. Now you should have a dynamic reference line! The only problem is that the axes of the two charts are not aligned
  6. 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
  7. 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!