Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ktlnrrrr
Contributor
Contributor

Number of observations based on the latest timestamp for EACH category

Hi! I wonder how I could get QS to show me the sum of observations in different categories. I'm trying to set up a dashboard to show how many rows each of my main data sources included the last time they got updated, and to check the latest timestamp the data source was updated -- to have an eye on if I have missing data anywhere. I load data for the last 7 days, and I want to present this in a table, where I sum up only rows for the last timestamp. 

I load the following data:

data_source; date; channel; market; last_timestamp, row_count

So far I've tried: 

Sum({<"date" = {"$(=Max(last_timestamp))"}>}row_count)

which ends up like this (the column in the front shows the names of the different sources, which I am not sharing, but you get the gist): 

Screenshot 2020-11-19 at 11.19.58.png

The total numbers include all 7 days of data in each source:

Sum(row_count)

Screenshot 2020-11-19 at 11.23.54.png

How do I get QS to show me the number of rows for the timestamp shown in the "latest timestamp" column, so that I get the number of observations that were uploaded into the souce on the latest date it was updated?

Thanks for thinking along!

 

 

Labels (3)
2 Replies
Chanty4u
MVP
MVP

try this

 

sum(If(Aggr(NODISTINCT Max(timestamp), row_count) = date, row_count))

 

or

=sum( {$<date={'$(=max(timestamp))'}>} rowcount )

or

=sum({$ < Date = {"$(=max(timestamp))"} >}row_count)

 

ktlnrrrr
Contributor
Contributor
Author

Hey! Thanks -- unfrotunately the 1st and last option give me the same as sum(row_count), 2nd seems to work with the max timestamp for the entire data, so like my 1st screenshot 😞 

I've realised the last_timestamp column in redundant as it has the same content as 'date' -- so tried your suggestions by subbing 'last_timestamp' with 'date'.