简体   繁体   English

SQL SSRS当前月份与月份值匹配

[英]SQL SSRS current month from month value match

I have some data; 我有一些数据;

customer name product month year 客户名称产品月年

In my dataset the only filter I have is for current year = true 在我的数据集中,我唯一的过滤器是当年= true

Otherwise, I have the rest of the fields above. 否则,我有上面的其余字段。 When I run my report, it is printing each month's totals. 当我运行报表时,它正在打印每个月的总计。 I only want it to print the current month's totals. 我只希望它打印当前月份的总数。 I've seem some other posts here and tried to mimick / copy but no luck 我在这里似乎还有其他帖子,试图模仿/复制但没有运气

So it's printing Customer Stickers Jan Feb Mar 2013, when I really only want it to print the current month, Mar 因此它正在打印Customer Stickers 2013年2月3日,当时我只希望它打印当月,

Thanks in advance 提前致谢

MonthName(Month(Fields!CurrentDate.Value),False) try this MonthName(Month(Fields!CurrentDate.Value),False)试试这个

If you let me know the exact field you are using i can help you with the expression 如果您让我知道您正在使用的确切字段,我可以为您提供帮助

You just need to add another filter to get just the current month: 您只需要添加另一个过滤器即可获取当前月份:

SQL Syntax for current monnth: 当前月份的SQL语法:

select Dateadd(month, datediff(month, 0, getdate()), 0)

OR 要么

where thing = Dateadd(month, datediff(month, 0, getdate()), 0)

Why don't you just filter out data for current month in the query of your dataset? 您为什么不只在数据集查询中过滤掉当月的数据? Something like: 就像是:

WHERE [year] = YEAR(CURRENT_TIMESTAMP) AND [month] = MONTH(CURRENT_TIMESTAMP)

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

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