简体   繁体   English

tableau 行级计算

[英]tableau row level calculations

I am trying to create a calculated field where it calculates the no.我正在尝试创建一个计算字段,用于计算编号。 of days the case is with CSE ie, support engineers, for that I have created 2 calculated fields cse-anything(cse-A date) and anything - CSE (A-CSE Date).几天的情况是与 CSE 即支持工程师,为此我创建了 2 个计算字段 cse-anything(cse-A 日期) 和任何 - CSE (A-CSE 日期)。

I need to take the diff between these two date fields, but the problem is for a particular case it a case can move n no.我需要获取这两个日期字段之间的差异,但问题是对于特定情况,案例可以移动n否。 of times to CSE.次到 CSE。 I need to find the diff between all the days and sum them up.我需要找到所有日子之间的差异并总结出来。

But the dates are in different level like:但是日期处于不同的级别,例如:

case id  a-cse  cse-a
101       null   10/19/18
          null . 11/19/18
         9/19/18  null
         10/19/18 null

In A-CSE I have to replace the null values with 9/19/18 and 10/19/18 and find diff.在 A-CSE 中,我必须用 9/19/18 和 10/19/18 替换空值并找到差异。

在此处输入图片说明

Assuming you have string null in the a-cse and a-cse is of string datatype.假设您在a-cse有字符串null并且a-cse是字符串数据类型。

Create a formula and write below code:创建一个公式并编写以下代码:

IF a-cse="null"
THEN
(REPLACE(a-cse,"null","9/19/18" ))
ELSE
a-cse
END

Create one more formula and write below code:再创建一个公式并编写以下代码:

DATE(([Calculation1]))

Do same for both the columsn now both columns have date datatype you can get the difference对两列都做同样的事情,现在两列都有日期数据类型,你可以得到差异

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM