简体   繁体   English

SSRS图表达式-自定义星期过滤器/表达式

[英]SSRS graph expression - custom week filter/expression

I've got a graph in SSRS, and as you can see in the picture below, there's no data before week 47. To make my graph more visually appealing, I would like to put a filter on it to ensure that its starting point is week 47. I've attempted to put a filter on my graph (picture attached below). 我在SSRS中有一个图表,如下图所示,在第47周之前没有数据。为了使我的图表更具视觉吸引力,我想在其上放置一个过滤器以确保其起点是第47周。我试图在图表上放置一个过滤器(下图)。 The problem is that if I set my week filter to >=47 then my graph won't show any data from 2019 , as the starting point for 2019 is week 1 which is obviously less than 47. Does anybody know what filter/expression I should use in order to make sure that starting point is week 47 without cutting off any data from 2019? 问题是,如果我将周过滤条件设置为> = 47,则我的图表将不会显示来自2019的任何数据,因为2019的起点是第1周 ,明显小于47。有人知道我使用什么过滤条件/表达式应该使用以确保起点是第47周而不会中断2019年的任何数据吗?

在此处输入图片说明

Try to stick the fields Year and Week to be in "YYYYWW" format (by adding a calculated field in Dataset directly in Reporting Services, for example) and filter the graph by [Year_Week] >= 201847. 尝试将字段Year和Week保留为“ YYYYWW”格式(例如,通过直接在Reporting Services中在数据集中添加计算字段),然后按[Year_Week]> = 201847过滤图形。

The calculated field [Year_Week] will be an integer and calculated like in example below (assuming that you have separated integer fields [Year] and [Week], so if this is not the case then the formula may differ from mine): 计算出的字段[Year_Week]将是一个整数,并按照下面的示例进行计算(假设您将整数字段[Year]和[Week]分开,因此,如果不是这样,则该公式可能与我的不同):

=CInt(CStr(Fields!Year.Value) & Right("00" & CStr(Fields!Week.Value), 2))

This image shows how my calendar table looks like with the new calculated field Year_Week which now can be used for filtering 此图显示了日历表的外观,其中新计算的字段Year_Week现在可以用于过滤

也许这可以做到:

[Week]>=47 OR [YEAR]>=2019

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

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