Forum Discussion
Displaying Latest Timestamp per Location in Table Visual with DirectQuery
- Anonymous1 year ago
Hi Diaze2108
Please try using this measure below, I hope it helps.
LatestData = VAR LatestTimestamp = CALCULATE( MAX(Snapshots[Timestamp]), ALLEXCEPT(Snapshots, Snapshots[Location]) ) RETURN CALCULATE( MAX(Snapshots[DataColumn]), //Replace with your data columns FILTER( Snapshots, Snapshots[Timestamp] = LatestTimestamp ) )Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Diaze2108
Please try using this measure below, I hope it helps.
LatestData =
VAR LatestTimestamp =
CALCULATE(
MAX(Snapshots[Timestamp]),
ALLEXCEPT(Snapshots, Snapshots[Location])
)
RETURN
CALCULATE(
MAX(Snapshots[DataColumn]), //Replace with your data columns
FILTER(
Snapshots,
Snapshots[Timestamp] = LatestTimestamp
)
)
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you! It finally worked!
I just had to add a second Measure to be able to Filter the Visual properly. At first I had- IF True = True, False =False and I the Filter option for the measure wouldn't open. After I changed it to 1 and 0, it worked.
Also- I was getting OECDB error because of exceeding 1000000 rows, so I had to use [Timestamp] as filter first. TopN = top 5 of Timestamp. This decreased the size of the calculation and it worked 🙂
IsLatestTimestamp =
VAR LatestTimestamp =
CALCULATE(
MAX(Snapshots[TimeStamp]),
ALLEXCEPT(Snapshots, Snapshots[Location])
)
RETURN
IF(
Snapshots[LatestData] = LatestTimestamp,
"1",
"0"
)