-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Window aggregations using .all() (for percent-of-total) must be defined in Python, not YAML.
YAML example that fails:
flights:
table: flights_tbl
measures:
total_distance: _.distance.sum()
distance_share:
expr: (_.distance.sum() / _.all(_.distance.sum())) * 100
# ❌ Error: _ (ibis Deferred) doesn't have .all() methodReproduce:
# See bsl-profiles branch: examples/percent_of_total.py
# WORKAROUND - Add programmatically:
from boring_semantic_layer import from_yaml
models = from_yaml("flights.yml", profile="example_db")
flights = models["flights"]
flights = flights.with_measures(
distance_share=lambda t: (t.distance.sum() / t.all(t.distance.sum())) * 100
)
flights.group_by("carrier").aggregate("distance_share").execute()Files: https://github.com/boringdata/boring-semantic-layer/blob/bsl-profiles/examples/percent_of_total.py
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working