根据筛选器类型和使用案例,最佳的解决方案可能有所不同。下面的选项在一个打包工作簿中演示,该工作簿可从本文右侧的“附件”部分下载。
从 Tableau Desktop 2020.1 开始,动态参数允许使用计算作为参数的默认值。请参见创建参数
相对日期筛选器会自动将日期更新为所选的相对范围,例如昨天。用户随后可更改相对范围。有关详细信息,请参见创建相对日期筛选器
使用“最新日期预设”功能。“最新日期预设”功能将在每次打开工作簿时更新为最近的日期。
注意:此功能仅可用于离散日期列表筛选器,而不适用于日期范围筛选器或允许用户从日历中选择日期的筛选器。
创建用户可在默认关键字键入的参数(例如“yesterday”)或任何日期以筛选视图。可以设置“yesterday”值以在计算字段中动态返回昨天的日期。请注意,此方法未提供日期下拉列表或滑块,并且只能在参数中键入一个日期。
IF [Enter 'Yesterday' or a Date] = "Yesterday"
THEN TODAY() - 1
ELSE DATE( [Enter 'Yesterday' or a Date] )
END
[Date Conversion] = [Order Date]
步骤 1:创建开始日期和结束日期参数
步骤 2(可选):创建参数以控制筛选器
步骤 3: 创建计算字段以用作筛选器
[Order Date] >= [Start Date]
AND [Order Date] <= [End Date]
[Choose Filter Range] = "All values"
OR
( [Choose Filter Range] = "Start to End Date"
AND [Order Date] >= [Start Date]
AND [Order Date] <= [End Date]
)
OR
( [Choose Filter Range] = "Last 7 days"
AND [Order Date] > DATEADD('day',-7,TODAY())
AND [Order Date] <= TODAY()
)
OR
( [Choose Filter Range] = "Start Date to Today"
AND [Order Date] >= [Start Date]
AND [Order Date] <= TODAY()
)
OR
( [Choose Filter Range] = "1 Month before End Date"
AND [Order Date] >= DATEADD('month', -1, [End Date])
AND [Order Date] <= [End Date]
)
为了表达您对在将来的产品版本中包括此增强功能的支持,请为以下社区理念投下您的一票:
从 Tableau Desktop 2018.2 开始,可以向 Tableau 仪表板中添加第三方扩展程序来增加功能。因此,您或许能够找到提供所需筛选器行为的扩展程序。有关详细信息,请参见使用仪表板扩展程序和 Tableau 仪表板的扩展程序开始了解。
001473758
2431 KB

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.