[英]How can I use SSRS to filter just on month when the date is in YYYY-MM-DD format?
我想忽略年份和日期......例如,如果 2018-09-08 和 2016-09-04 存在两个不同的 personID,如果我将月份过滤为“九月”,我希望两行日期都出现
Assuming you want to do this in the dataset filter properties rather than in your dataset query and also assuming you have a report parameter called @pMonth
then you can add a filter to the dataset.假设您想在数据集过滤器属性中而不是在数据集查询中执行此操作,并且还假设您有一个名为
@pMonth
的报告参数,那么您可以向数据集添加过滤器。
Set the filter expression to =Month(Fields!myDateColumn.Value)
and the value expression to =Parameters!pMonth.Value
将过滤器表达式设置为
=Month(Fields!myDateColumn.Value)
并将值表达式设置为=Parameters!pMonth.Value
If you wanted to only ever show the records that match the parameter then it's best to do this in the dataset query, that way you only return what you need rather than return lots of data that never gets used.如果您只想显示与参数匹配的记录,那么最好在数据集查询中执行此操作,这样您只会返回您需要的内容,而不是返回大量从未使用过的数据。
To do this in SQL Server you would do something similar...要在 SQL Server 中执行此操作,您将执行类似的操作...
SELECT *
FROM myTable t
WHERE MONTH(t.myDateColumn) = @pMonth
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.