Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

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?

Niiru1_2-1634052443003.png

I have a simple table of values

Niiru1_0-1634052286266.png

 and want to get the value that today is closest to e.g. TODAY = 10/12/2021 therefore 10/10/2021 value 24

 

PBIX attached

https://www.dropbox.com/s/utwcn6vwl8xedfp/Set%20Limit%20of%20Future%20Appointment%20within%201%20Mon...

1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

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

vjaneygmsft_1-1635400202217.png

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 () )
    )

 

vjaneygmsft_0-1635400011325.png

 

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

View solution in original post

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

According to your description, I think you can create a measure to display your desired result.

Like this:

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

vjaneygmsft_1-1634292197157.png

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

Anonymous
Not applicable

Hi,

 

Thanks for this.

 

I've used the following formula to attempt your solution:

Measure5 = 

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

 

but still blank values. Any advice on this would be greatly appreciated.

 

Niiru1_0-1634295984643.png

 

Hi, @Anonymous 

 

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

vjaneygmsft_1-1635400202217.png

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 () )
    )

 

vjaneygmsft_0-1635400011325.png

 

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

amitchandak
Super User
Super User

@Anonymous , Create a second measure and plot that

 

measure 2= calculate(sum(Table[Value]), filter(Table, Table[Date]=Today())

 

or create bar and do condition formatting using this measure

 

if(max(Table[date]= Today(), "Red","blue")

or

if(max(Table[date]= Today(), "Red", blank() )

 

use that in conditional formatting using field value option and then convert bar to line

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.