Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Add shelf constants syntax #138

Open
chrisgemignani opened this issue Oct 14, 2020 · 0 comments
Open

Add shelf constants syntax #138

chrisgemignani opened this issue Oct 14, 2020 · 0 comments

Comments

@chrisgemignani
Copy link
Member

We had an issue that looks like this

Howdy! I have advanced ingredients where I want values associated with the max date in my dataset. Right now, I am hard coding the date, but each time I load updated data, I have to adjust all my ingredients. Here’s an example:

kind: Measure
field: 'sum(Covid_Cases) / sum(if(Date="2020-10-12", F2F_Students___Staff)) * 1000'

The user wanted to be able to define a shelf where "2020-10-12" is the maximum date value in her dataset. The intent looks like this:

field: 'sum(Covid_Cases) / sum(if(Date=max(Date), F2F_Students___Staff)) * 1000'
format: ',.1f'
singular: 'Covid-19 Cases per 1,000 F2F

max(Date) would typically require a subquery.

A solution: Create a syntax for defining shelf constants. These would be simple calculations that could be performed before the shelf is evaluated. It should probably NOT take into account automatic filters.

Uses

  • Find the max date in a dataset.
  • Find the "top N" values in a dimension. This would enable creating a bucket with an other category.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant