Get counted data points (TikTok Posts) into Grafana Graph not only Stat

I was able to generate the total count of unique TikTok Posts in InfluxDB with the Flux code below and can show this as “stat” in my Grafana Dashboard.
But i can’t find a way to visualise this with a graph over time.
It seems the distinct() function kills the time values or something.
Very much appreciate any help!
a.

from(bucket:“PERFORMANCE_DATA”)
|> range(start: - 30d)
|> filter(fn: (r) => r._measurement == “TikTok_Posts” and r.music_album == “${TikTok_Sound}”)
|> keep(columns: [“_time”, “aweme_id”])
|> distinct(column: “aweme_id”)
|> group()
|> count()
|> group()

Welcome @aw_cyl

I tested this on my data and I agree that adding distinct() to the Influx query kills the query because the time field goes away.

However, I found this to work for me: