Bases Window Functions

Use case or problem

I’d love to run something a bit more analytical with my bases, for example I have a bases table for my cat that lists their weights, time recorded, and how hungry they are.

views:
  - type: table
    name: Table
    filters:
      and:
        - file.inFolder("Personal/Pets/Pet Weights")
        - for_pet == PetName
    order:
      - time_recorded
      - weight
      - weight_unit
      - hunger_scale
    sort:
      - property: time_recorded
        direction: DESC

I would love to add more information, such as weight/time deltas that in a traditional DB I would have used a window function to create. For example sql servers LAG function:

SELECT
     time_recorded
     , weight
     , weight_unit
     , hunger_scale
     , weight - LAG(weight) OVER (ORDER BY time_recorded) AS weight_delta
FROM ...

Proposed solution

Some SQL like window function to help produce these more analytical breakdowns. Alternatively sub base_view that is filtered to 1 row and timestamp before the current row.

Current workaround (optional)

None that I’m aware of.

1 Like

What in particular makes you to use bases as your primary data analytics tool?

I tend to live in Obsidian and wanted to try :man_shrugging:t2: I like that I have a very capable tool that syncs and is available across the platforms I use, throwing some basic stuff like this seems useful.

Edit to Add:
This was more of an experiment to see if I could store this kind of information and even prototype some stuff.

Nice :slightly_smiling_face: :+1: I definitely like the cross platform aspect and especially comprehensive uniformity between mobile and desktop.

Bases are already in a level of providing basic to advanced features so in a sense one could expect more advanced features at least through plugin API.