简体   繁体   中英

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.

Set the filter expression to =Month(Fields!myDateColumn.Value) and the value expression to =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...

SELECT * 
    FROM myTable t 
    WHERE MONTH(t.myDateColumn) = @pMonth

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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