如何在 Tableau 中将数据标准化为一个范围 [英] How to normalize data to a range in Tableau

查看:48
本文介绍了如何在 Tableau 中将数据标准化为一个范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Tableau 中,我尝试实现以下规范化逻辑:

In Tableau, I am trying to implement the following normalization logic:

https://stats.stackexchange.com/questions/70801/how-to-normalize-data-to-0-1-range

基本上,我想从特定度量中获取所有值并将它们缩放到 [0, 1] 范围内的值.这需要收集度量的最小值和最大值.我想要的是...

Basically, I want to take all values from a particular measure and scale them to values in the range of [0, 1]. This requires gathering the minimum and the maximum of a measure. What I want is...

(x - min(x)) / (max(x) - min(x))

如果您使用上述链接的方法创建计算字段,则会收到无法混合聚合和非聚合"错误.

If you create a calculated field using the above link's method, you get the "Cannot mix aggregate and non-aggregate" error.

这就是我被卡住的地方.有什么功能和/或技巧可以让它发挥作用吗?

This is where I am stuck. Is there a function and/or trick to get this to work?

推荐答案

您需要使用 LOD 表达式 告诉 Tableau 您需要所有 x 值的最小值,而不仅仅是那一行.试试:

You need to use LOD expressions to tell Tableau that you want the min of all the x values, not just that row. Try:

    (x -{FIXED : MIN(x)})
    /
    ({FIXED  : MAX(x)}-{FIXED  : MIN(x)})

这篇关于如何在 Tableau 中将数据标准化为一个范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆