Tableau中的网络日

时间:2017-05-08 20:00:40

标签: tableau tableau-online

我需要在Tableau中使用以下表达式创建网络或工作日 我已经根据不同的计算创建了网络日,但不确定我应该如何链接它。
代码是:

if ISNULL([Resolved Date])   
then TODAY()- [Pending Date] // 1st condtion    
ELSEIF ISNULL([Pending Date]) and [Resolved Date] !=NULL  
THEN  
[Resolved Date]-[Assigned Date] // 2nd condition   
ELSEif ISNULL([Pending Date]) and ISNULL([Resolved Date])   
then   
TODAY()- [Assigned Date]  
else  
[Resolved]

如何从上述公式中删除周末。

3 个答案:

答案 0 :(得分:0)

Interworks blog post描述了如何在不计算周末的情况下查找两个日期之间的差异。它没有解决假期问题。

答案 1 :(得分:0)

找到答案,为其他用户的利益发布

ABS(if ISNULL([Resolved Date])
then  (DATEDIFF('day',TODAY(),[Pending Date]) - (DATEDIFF('week',TODAY(),
[Pending Date])*2))
ELSEIF ISNULL([Pending Date]) and [Resolved Date] !=NULL
THEN
(DATEDIFF('day',[Resolved Date],[Assigned Date]) - (DATEDIFF('week',
[Resolved Date],[Assigned Date])*2))
ELSEif
(ISNULL([Pending Date]) OR  ISNULL([Resolved Date]) )
then
(DATEDIFF('day',[Assigned Date],TODAY()) - (DATEDIFF('week',[Assigned 
Date],TODAY())*2))//DATEDIFF('day',[Assigned Date],TODAY()) 
else
(DATEDIFF('day',[Resolved Date],[Pending Date]) - (DATEDIFF('week',[Resolved 
Date],[Pending Date])*2))//[Resolved Date]-[Pending Date]
END)

答案 2 :(得分:0)

您还可以使用this link计算营业日,并可选择指定单个假期以及营业开始和结束时间。