Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Today value on line graph

I'm trying to get today's value (a point or vertical line) to appear on a line graph if that's possble? I have a simple table of values  and want to get the value that today is closest ...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    4 years ago

    Hi, Anonymous 

     

    I am back. The code in my sample is no problem. But you modified it wrong when you used it.

    I used your sample, and modify it.

    Try this:

    Measure5 =
    VAR a =
        MAXX ( FILTER ( ALL ( 'Table' ), [Date] <= TODAY () ), [Date] )
    VAR b =
        MINX ( FILTER ( ALL ( 'Table' ), [Date] >= TODAY () ), [Date] )
    VAR c =
        IF ( TODAY () - a >= b - TODAY (), b, a )
    RETURN
        IF (
            SELECTEDVALUE ( 'Table'[Date] ) = c,
            SELECTEDVALUE ( ( 'Table'[Value] ), BLANK () )
        )
    

     

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.


    Best Regards,

    Community Support Team _ Janey