动态滑块Tableau百万/十亿

问题描述

我正在处理一个简单的Tableau工作表,该工作表需要获取数量和日期。

数字很大,所以有时它会达到数百万/十亿,并且我使用滑块过滤器类型,可以在其中选择自己关心的范围。

不幸的是,滑块中的值太大,我想通过在滑块中值为十亿时使用“ B”,在值为百万时使用“ M”并在滑块中使用数千时使用“ K”来提高可读性。

为此,我首先创建了一些参数:

  1. 十亿:

enter image description here

  1. 百万:

enter image description here

  1. 数千:

enter image description here

最后,我创建了一个计算字段:

if str([Volume]) = str([Billions]) THEN float(replace(str(round([Volume],-9)),"000000000","B"))
ELSEIF str([Volume]) = str([Millions]) THEN float(replace(str(round([Volume],-6)),"000000","M"))
ELSEIF  str([Volume]) = str([Thousands]) THEN float(replace(str(round([Volume],-3)),"000","K"))
else float(str([Volume])) END

不幸的是,这不起作用。

有人对如何达到我想要的解决方案有建议吗?或更好的方法呢?

非常感谢!

解决方法

不是创建多个参数,而是创建一个这样的参数。命名为TMB

enter image description here

像这样添加计算字段(每个用于期望的度量)。为[sales]

[sales]/TMB

您可以按照想要的方式调整度量

enter image description here

enter image description here