It is simple; You can define a view over the fact table, in which adding a new column to materialize the calculation of "CASE WHEN (host="local") then 1 else 0 end", say its name is IS_LOCAL; Then use the view to as the fact table in cube, adding SUM(IS_LOCAL) as a measure, that's it!; After the cube be built, you can query as: select SUM(IS_LOCAL)/count(*) * 100 as hostpercent FROM view1.
2017-02-02 21:31 GMT+08:00 Alberto Ramón <a.ramonporto...@gmail.com>: > short answer: no > > nowadays: We have Sum, count, Max , min, Avg, count distinct, TopN > Deprecated: Raw > Future: Percentile (see Kylin 2396) > > Alternative solutions: > http://apache-kylin.74782.x6.nabble.com/Derived-measures- > in-Kylin-td5513.html > > Tip: See this bug Kylin 2341, I think can be important for you > > 2017-02-01 17:27 GMT+01:00 陈光亮 <thecgl1...@163.com>: > > > HI, > > sorry,my English very pool. > > I have some problem when I do demo. > > I want take some fields to percent function. > > For example: > > table1 > > id host pid > > 1 local 321 > > 2 local 123 > > 3 google 987 > > 4 google 789 > > SELECT (SUM(CASE WHEN (host="local") then 1 else 0 end)/count(*)*100) > > as hostpercent FROM table1 > > The sql result is 50%. Mysql or hive can do this,but i don't know does > > kylin support this action? > > please help me, thank you! > > > > > > > > > > > -- Best regards, Shaofeng Shi 史少锋