Forum Discussion
Show only last value in line chart?
- 2 years ago
Hi!
I don't know how your data is structured so you have to adjust accordingly, but basically you want to figure out the max date where there is a value and then return blank() for all values that aren't the last point.
LastValueLabel = VAR __LastDate = CALCULATE(MAX('Dates'[Date]), ALL('Dates')) RETURN IF( SELECTEDVALUE('Dates'[Date]) = __LastDate, [YourMainMeasure], BLANK() )And then add that measure as the Value on the Data Label for your series.
Good luck!
thank you all for your replies.
i addition to the base problem, i had a mixture of datatypes and empty fields. so i had to correct that and query for the last not empty value, ending up with this:
ucPerabc_lastval =
VAR LastIndex =
MAXX(
FILTER(ALL(ucanen[Zeit.Monat]); NOT(ISBLANK([ucPerabc])));
ucanen[Zeit.Monat]
)
-- Get the last index where ucPerabc is not blank
VAR CurrentIndex = SELECTEDVALUE(ucanen[Zeit.Monat]) -- Get the current row’s index value
VAR LastucValue = CALCULATE([ucPerabc]; ucanen[Zeit.Monat] = LastIndex) -- Calculate the uc value for the last valid index
RETURN
IF(
CurrentIndex = LastIndex; -- Compare the current row's index with LastIndex
ROUND(LastucValue; 0); -- Show the value only for the last index where data is present
BLANK()
)
i added that measure as y Axis and showed the value.