spotfire - 在 Spotfire 表中排名、分组和设置标签
问题描述
我有两列 [Clients] 和 [Sales],我想创建一个新列,其中包含每个“客户”在销售额方面的评分(从 1 到 5)。我想对 [Sales] 进行排名并将其分成 5 组,然后将标签 1 设置为最高 [Sales],2 设置为第二组,依此类推……有人知道表达方式吗?利用 ?
解决方案
您可以将 percentile 函数与 case 语句结合使用。在下面的屏幕截图中,我创建了 5 个计算来找到第 20、第 40、第 60 和第 80 个百分位数,然后创建了一个案例陈述以根据这些值进行排名。
百分位数计算:
Percentile([Sales],20)
案例陈述:
case
when [Sales]<[20th Percentile] then 1
when ([Sales]>=[20th Percentile]) and ([Sales]<[40th Percentile]) then 2
when ([Sales]>=[40th Percentile]) and ([Sales]<[60th Percentile]) then 3
when ([Sales]>=[60th Percentile]) and ([Sales]<[80th Percentile]) then 4
when [Sales]>=[80th Percentile] then 5
else NULL
end
见附件截图 数据样本和计算
推荐阅读
- javascript - 拒绝加载图像“http://localhost:8080/favicon.ico”,因为它违反了
- python - 将多个函数应用于同一列
- c - 为什么此 printList 函数不适用于 C 中的链接列表
- r - R - 如何导入带有块的巨大 .csv?
- spring-boot - 从嵌入式 Teiid 服务器访问表元数据
- kendo-ui - Kendo DataSource 捕获服务器响应
- c# - 为什么我的 Azure HTTP 触发器函数返回的数据比我指定的输出模型多?
- javascript - 播放全屏时,视频触摸事件不会在 iOS Safari 上触发
- excel - 如何通过首先查询 MAx 列并添加 1 来将 excel 数据导出到 MS Access?
- android - 如何修复我的相机谷歌地图android工作室