Filip Charikov
08/06/2025, 7:05 PMsum over(partition by id) / count(distinct id)
sorta thing.
I have a table with id and parent_id. I have another table with metric/fact that I have to AVG on parent_id (it contans only parent_id and matric). In GD LDM I have the table with id and parent id joined with a m-n to the table with parent_id and metric/fact. Whatever I try with BY, BY ALL etc doesn't actually calculate the AVG I want (by parent_id), it always calculates by the id. In the chart I use filters from the table that contains the id (lower aggregation than I want).Filip Charikov
08/06/2025, 7:10 PMSELECT AVG(ar_days)
does the calculation of the last table on the right, and I want the one that says 11.9Michael Ullock
08/06/2025, 8:47 PMMichael Ullock
08/06/2025, 10:41 PMMichal Hauzírek
08/07/2025, 2:49 PMAVG(ar_days)
should give you the result from the left table. The system is trying to maintain the fact granularity and do not multiply it. But it then won’t allow you to slice this value by i.e. payment method (unless there is the many-to-many edge or you tell the system you are OK to expand the value with something like SELECT AVG(ar_days) BY ALL payment_method
. As far as I know it should only multiply if there is a many-to-many arrow (double-sided) or if you explicitly do this “lifting” with a BY
keyword like: SELECT AVG( SELECT ar_days BY id)
- Then I would expect this metric to give you the results from your right (expanded) table.
Could you please help me understand how does the logical data model look like and what is the resulting report you are trying to achieve (what you want to calculate and by what you want to filter/view it)?
Thank you.Filip Charikov
08/07/2025, 3:28 PMSELECT SUM(
(SELECT SUM({fact/ardays}) by {label/parent_id})
/
(SELECT COUNT({label/parent_id})))