标签:.com oca mail sum 说明 efi ast isp EDA
cube.js 对于measure以及dimension 提供了丰富的数据类型,基本满足我们常见应用的开发,同时对于不同类型也提供了
格式化的操作
purchasesRatio: {
sql: `${purchases} / ${count} * 100.0`,
type: `number`,
format: `percent`
}
numerOfUsers: {
type: `count`,
// optional
drillMembers: [id, name, email, company]
}
类似sql 的count distinct
uniqueUserCount: {
sql: `user_id`,
type: "countDistinct"
}
字面意思是countDistinct 的添加剂,同时和countDistinct 不一样,他是利用rollup-pre-aggregations,后端利用
hll或者类似的算法,加速数据的计算
uniqueUserCount: {
sql: `user_id`,
type: "countDistinctApprox"
}
类似sql 的sum,但是与原生sql 不同,他将正确的计算数据,尽管连接可能导致数据重复
revenue: {
sql: `amount`,
type: `sum`
}
类似sql 的avg 进行平均数的计算,但是与原生sql 不同,他将正确的计算数据,尽管连接可能导致数据重复
averageTransaction: {
sql: `${transactionAmount}`,
type: `avg`
}
dateFirstPurchase: {
sql: `date_purchase`,
type: `min`
}
dateLastPurchase: {
sql: `date_purchase`,
type: `max`
}
计算概述sql 中的值
totalSubscriptions: {
sql: `subscription_amount`,
type: `runningTotal`
}
purchaseConversion: {
sql: `${purchase}/${checkout}*100.0`,
type: `number`,
format: `percent`
}
totalAmount: {
sql: `amount`,
type: `runningTotal`,
format: `currency`
}
completedAt: {
sql: `completed_at`,
type: `time`
}
fullName: {
sql: `CONCAT(${firstName}, ‘ ‘, ${lastName})`,
type: `string`
}
amount: {
sql: `amount`,
type: `number`
}
location: {
type: `geo`,
latitude: {
sql: `${TABLE}.latitude`,
},
longitude: {
sql: `${TABLE}.longitude`
}
}
image: {
sql: `CONCAT(‘https://img.example.com/id/‘, ${id})`,
type: `string`,
format: `imageUrl`
}
image: {
sql: `id`,
type: `number`,
format: `id`
}
orderLink: {
sql: `‘http://myswebsite.com/orders/‘ || id`,
type: `string`,
format: `link`
}
crmLink: {
sql: `‘https://na1.salesforce.com/‘ || id`,
type: `string`,
format: {
label: `View in Salesforce`,
type: `link`
}
}
amount: {
sql: `abount`,
type: `number`,
format: `currency`
}
penRate: {
sql: `COALESCE(100.0 * ${uniqOpenCount} / NULLIF(${deliveredCount}, 0), 0)`,
type: `number`,
format: `percent`
}
https://cube.dev/docs/types-and-formats
cube.js 学习(七)cube.js type 以及format 说明
标签:.com oca mail sum 说明 efi ast isp EDA
原文地址:https://www.cnblogs.com/rongfengliang/p/10804569.html