evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
3.38k stars 164 forks source link

Add aggregation to the value component #1937

Open jaroet opened 2 weeks ago

jaroet commented 2 weeks ago

Feature Description

The current Value component allows you to show a single value based of a query. When a specific row pointer is supplied it will show that value. I would like to see the option to, in absence of a row pointer, to add an aggregation to this component.

Goal of Feature

This feature would allow me to be more smart in my use of SQL queries.

For example : If I have a query named issues this consist of the following SQL select assignee, count(*) as count from issues

Before showing this query in a DataTable component or something I add some text to the start of the Markdown page and in this text I want to reference the number of unique assignees and the total number of issues I would like to do this using the Value components with the following code

Current Solution / Workarounds

Currently I can do this by adding 2 separate SQL statements and point the value component to each of them.

Not a big issue to do but if there are more values you would like to show in the text you add extra queries in your page that I think are not needed. So the end-result will be cleaner.

Alternatives

See workarounds