获取红移中值的百分比

mklgxw1f  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(228)

如果这个问题被问到或提到其他地方,请让我去那个地方
我正在尝试获取用户总数中新用户的百分比,并使用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%)。我不知道该怎么编辑。
谢谢你的帮助。
投资计数

新建与重复

饼图结果

cmssoen2

cmssoen21#

我想你想要:

select investments
       avg(case when investments = 1 then 1.0 else 0 end) as ratio_new_user
from investments_count
group by investments

相关问题