You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/11 11:01:35 UTC

[GitHub] [superset] EBoisseauSierra opened a new issue, #19644: Combining Saved Metrics in Explore/Custom SQL panel

EBoisseauSierra opened a new issue, #19644:
URL: https://github.com/apache/superset/issues/19644

   ## The problem I have
   
   I would like to combine a dataset's Saved Metrics to compute new ones and stay DRY. But it's currently not possible.
   
   ## The solution I'd like
   
   Say I'm tracking my widget production, and record for each batch how many items have been produced and how long it took.
   I can then define at the Dataset level the following Saved Metrics: 
   * `SUM(quantity) AS production`, and
   * `SUM(duration) AS work_hours`.
   
   Imagine I'd now like to plot productivity over time: I would love to go to the Explore Panel, create a line chart which Metric would be `production / work_hours`. However, this is currently only possible with Calculated Columns, not Saved Metrics.
   
   I could also want to be able to define `productivity` as a new Saved Metric (but I understand this might be trickier, due to definitions dependencies resolution).
   
   ## Some possible (sub-optimal) alternatives
   
   It is obviously possible to define the `productivity` KPI as `SUM(quantity) / SUM(duration)` — either as a new Saved Metric or Custom SQL.
   
   But this isn't DRY, what causes some issues should I want to change, say, how I compute `work_hours` (two Saved Metrics definition to change), or if my Saved Metrics are a bit convoluted (risk of errors in copy-pasta). 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on issue #19644: Combining Saved Metrics in Explore/Custom SQL panel

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #19644:
URL: https://github.com/apache/superset/issues/19644#issuecomment-1404623961

   @EBoisseauSierra I realize this Issue has gone unattended for quite a while. Sorry about that :/
   
   Are you still interested in this as a feature, or have you found a workable workaround/solution?  I'm not quite sure if we should close this issue as "stale" or move it to a Github Discussion under the Ideas thread. But I think it's fair to say the ol' open source adage that we're happy to review a PR if you're interested in tackling this, or considering a SIP if you think it's a larger effort you're willing to help usher through.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Combining Saved Metrics in Explore/Custom SQL panel [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #19644: Combining Saved Metrics in Explore/Custom SQL panel
URL: https://github.com/apache/superset/issues/19644


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Combining Saved Metrics in Explore/Custom SQL panel [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #19644:
URL: https://github.com/apache/superset/issues/19644#issuecomment-1959932228

   Closing this as stale since it's been silent for so long, and is a feature request rather than a bug. If this is relevant in current versions (currently 3.x) please open a new Ideas discussion or a PR/SIP to address the problem.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ValeriyaKur commented on issue #19644: Combining Saved Metrics in Explore/Custom SQL panel

Posted by "ValeriyaKur (via GitHub)" <gi...@apache.org>.
ValeriyaKur commented on issue #19644:
URL: https://github.com/apache/superset/issues/19644#issuecomment-1445393629

   > @EBoisseauSierra I realize this Issue has gone unattended for quite a while. Sorry about that :/
   > 
   > Are you still interested in this as a feature, or have you found a workable workaround/solution? I'm not quite sure if we should close this issue as "stale" or move it to a Github Discussion under the Ideas thread. But I think it's fair to say the ol' open source adage that we're happy to review a PR if you're interested in tackling this, or considering a SIP if you think it's a larger effort you're willing to help usher through.
   
   Hi!
   The question is relevant. My company is transferring reports from Power BI to a superset. The PBI calmly coped with such a task.
   On my own behalf, I will add that the ability to calculate metrics based on other metrics is needed not only in the set, but also in the charts metrics.
   Because in the charts, when trying to enter a custom metric calculation:
   `SELECT 
   "DateTransit_WeekISO" AS "DateTransit_WeekISO",
   "Reason_DR" AS "Reason_DR",
   case
   when the sum(qnt_rdr) exceeds(split into "DateTransit_WeekISO", "Reason_DR") = 0, then 0
   else (sum(qnt_rdr) over(section by "Name", "AG", DateTransit_Week IS, is_virtual, OperType, Reason_DR, Reason_OD))/(SUM(qnt_rdr) over(section by DateTransit_WeekISO, Reason_DR))
   ends AS Reason_DR_perce
   from "OP_all_users".
   Group "SSet_SupplyMonitor_transit_new" by transition date in a week, Reason_DR
   LIMIT 10000;`
   
   ClickHouse throws an error:
   SQL error [215] [07000]: Code: 215. DB::Exception: The column `qnt_rdr` is not in the aggregate function and is not in the BY group. There are columns: ['Reason_DR','DateTransit_WeekISO']


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org