Note: This is an early feature launch announcement, meaning the feature is still in development. We make this announcement early to gather feedback and make sure what we build actually helps solve our users’ use cases.
Holistics is currently working on a significant improvement to our Modeling layer called “Dynamic Models” (feature request). This feature allows analysts to define reports that can take user inputs, and inject them directly into a model/report definition.
This feature is currently under development and is expected to be released in beta end of Q2 2023. Once released, it will only be available in Holistics 4.0.
How it works:
- A new concept is introduced, called “dynamic model” — a data model that can take in parameters and will only be resolved in real-time.
- Analysts can create reports from dynamic models
- When a dynamic model is used in a report, end users can input values that feed directly into the model’s parameters
Passing user inputs into SQL query
Suppose we want to build a report that performs a simple distribution of “how many people bought X number of orders?”. We also want the end users to filter down by different customer demographics (e.g user gender).
The SQL for this analysis is complex and requires a subquery to pre-aggregate the number of orders. Without Dynamic Models, interactive filtering from end users is impossible within Holistics. With Dynamic Models, it is.
We build a dynamic model that can take in a gender
parameter and pass them to the complex SQL definition inside.
Model order_distribution(gender_param: String) {
type: 'query'
query: @sql
WITH user_order_count AS (
SELECT o.user_id AS user_id
, count(o.id) AS user_orders
FROM ecommerce.orders o
LEFT JOIN ecommerce.users u ON o.user_id = u.id
WHERE u.gender = '${gender_param}'
GROUP BY 1
)
SELECT user_orders
, count(user_id) AS total_users
FROM user_order_count
GROUP BY 1
;;
dimension user_orders { ... }
dimension total_users { ... }
}
Here, the parameter goes directly into the SQL definition.
When exploring a dataset, end users can set values for gender
via the UI
Injecting user inputs with attributes
The model parameters can also be used with a measure/dimension definition.
Say you want a list of products and to apply a tax rate on top, but you want the end users to experiment with different tax rates to see what the final charge looks like.
Model products_with_tax (tax_rate: number) {
dimension id { .. }
dimension cost { .. }
dimension cost_with_tax {
type: 'number'
definition: @sql cost * (1 + ${tax_rate}) ;;
}
}
The dynamic model will allow your end users to freely try different tax rates and see the end results on the fly.
If you have any questions about the feature, feel free to ask below.