# DAX Solution for Creating a Vertical Line in Line Graph



## evandam (Jun 30, 2015)

Hi all,

I'm not even sure if this is possible, but perhaps there is a workaround. I have a line graph pivot chart from my data model, and I would like to add a vertical line or some other indicator for today's date. Is it possible to create a measure that would run a (close to) vertical line from my lowest value to my highest for the current day/month/year? I'm guessing that trying to create a formula to define an undefined slope is a problem, but who knows...

Thank you!


----------



## Ozeroth (Jun 30, 2015)

One possibility:

Create a measure that evaluates to the maximum value when Date=today (otherwise blank)
Change Series Chart Type to Bar (for that series only)
Make the bar as narrow as possible so that it looks like a line (by increasing gap width).
The measure could be something like this:


```
=IF (
    HASONEVALUE ( Dates[Date] ),
    IF (
        VALUES ( Dates[Date] ) = [B]TODAY()[/B]<today>,
        MAXX ( [B]ALL ( Dates[Date] )[/B], [Original measure]<original measure="">)
    )
)
```
TODAY() and ALL(Dates[Date]) may need to be changed depending how your model defines "today" and which dates you want to calculate the max over.</original></today>


----------



## evandam (Jun 30, 2015)

Ah, changing that series to a column chart would be perfect! I'll give this a shot.

Thank you!


----------



## evandam (Jun 30, 2015)

I was actually able to take your measure and simplify it since there is an option for a secondary axis that will auto-scale. Small tweaks to fit my data since my view is actually grouping by month/year, so I'm checking if today's date fits in the range, not an exact match:

```
Today:=IF(MIN(dimDate[FullDate]) <= TODAY() && MAX(dimDate[FullDate]) >= TODAY(), 1)
```

Thanks again


----------

