Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 to e.g. TODAY = 10/12/2021 therefore 10/10/2021 value 24
PBIX attached
Solved! Go to Solution.
Hi, @Niiru1
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
Hi, @Niiru1
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 ()
)
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
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.
Hi, @Niiru1
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
@Niiru1 , 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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |