0

如果在其他地方提出或引用了这个问题,请让我去那个地方

我正在尝试获取用户总数中新用户数量的百分比,并使用 Periscopedata(Sisense)在饼图中显示。

select
  investments
  , case
    when investments > 1
      then 'returning user'
    else 'new user'
  end as "N or R"
from
  investments_count
group by
  investments

返回表返回正确的值,但饼图返回错误的百分比(应该是 29% 而不是 2%)。我不确定如何编辑它。

感谢您的帮助。

投资计数

在此处输入图像描述

新与重复

在此处输入图像描述

饼图结果

在此处输入图像描述

4

1 回答 1

0

我想你想要:

select investments
       avg(case when investments = 1 then 1.0 else 0 end) as ratio_new_user
from investments_count
group by investments
于 2020-06-23T17:12:28.263 回答