Crystal reports “中有两个值的条形图”;更改为“;,跳过值为0的条

Crystal reports “中有两个值的条形图”;更改为“;,跳过值为0的条,crystal-reports,Crystal Reports,我有一个基于以下sql语句的Crystal Reports条形图: Select 'Max' as Name, '2018-05-02' as Day union all select 'Max', '2018-05-02' union all select 'Max', '2018-05-02' union all select 'Fritz', '2018-05-02' union all select 'Fritz', '2018-05-02' union all select 'Frit

我有一个基于以下sql语句的Crystal Reports条形图:

Select 'Max' as Name, '2018-05-02' as Day
union all select 'Max', '2018-05-02'
union all select 'Max', '2018-05-02'
union all select 'Fritz', '2018-05-02'
union all select 'Fritz', '2018-05-02'
union all select 'Fritz', '2018-05-03'
union all select 'Fritz', '2018-05-03'
union all select 'Fritz', '2018-05-03'
union all select 'Max', '2018-05-04'
也就是说,我有三天的数据,在每一天,一些名字可能会出现多次。现在我想展示一个图表,在这个图表中,我可以看到每天每个名字出现的频率。我尝试使用以下设置:

我得到的结果与我想要达到的目标非常接近:

然而,问题是图表每天为所有两个名字保留空间。当有两个以上的名字,而每天只有几个名字出现时,这就成了一个问题

如本例所示,每个名称仅在几天内出现的名称多得多:

Select 'Max' as Name, '2018-05-02' as Day
union all select 'Max', '2018-05-02'
union all select 'Max', '2018-05-02'
union all select 'Hans', '2018-05-02'
union all select 'Beate', '2018-05-02'
union all select 'Luise', '2018-05-02'
union all select 'Sandra', '2018-05-02'
union all select 'Fritz', '2018-05-02'
union all select 'Fritz', '2018-05-02'
union all select 'Fritz', '2018-05-03'
union all select 'Fritz', '2018-05-03'
union all select 'Fritz', '2018-05-03'
union all select 'Max', '2018-05-04'
union all select 'Rainer', '2018-05-04'
union all select 'Elvira', '2018-05-04'
union all select 'Silvia', '2018-05-04'


对于每一天,将为任何一天中出现的每个名称保留空间。是否可以让Crystal Reports跳过这些列,只为值不是0的列保留空间?

据我所知,在Crystal Reports的内置柱状图中不可能做到这一点。至少,不是“自然的”

但是,根据你的必备条件,你可以尝试下面描述的东西。但你将不得不使用数据和选项来尝试获得一些像样的东西

基本思想是格式化数据,使图表成为公共柱状图(无组)。这样,您就摆脱了“零列”

首先,将select命令更改为类似以下内容:

select Name, Day, Day + ': ' + Name as DayAndName, Count(*) as Count from (
    Select 'Max' as Name, '2018-05-02' as Day
    union all select 'Max', '2018-05-02'
    union all select 'Max', '2018-05-02'
    union all select 'Hans', '2018-05-02'
    union all select 'Beate', '2018-05-02'
    union all select 'Luise', '2018-05-02'
    union all select 'Sandra', '2018-05-02'
    union all select 'Fritz', '2018-05-02'
    union all select 'Fritz', '2018-05-02'
    union all select 'Fritz', '2018-05-03'
    union all select 'Fritz', '2018-05-03'
    union all select 'Fritz', '2018-05-03'
    union all select 'Max', '2018-05-04'
    union all select 'Rainer', '2018-05-04'
    union all select 'Elvira', '2018-05-04'
    union all select 'Silvia', '2018-05-04'
) X
group by Name, Day
然后按如下方式配置柱状图:

第一个结果将是丑陋的。那么,挑战在于如何让它看起来像样。也许不可能把它做得足够好。但不会有“零列”


开始的提示是使用列标签而不是图例,并注意顺序。

谢谢您的回答,但它忽略了一些重要的要求(对于问题来源的用例):按天对列进行分组,并对同一个人使用相同的颜色。Yoy可能会尝试另一种可能不太好的可能性:按日期对详细信息进行分组,并在单独的图表中绘制每个日期。但我认为结果会更糟,而且颜色可能不匹配。我没有试过这个,我只是想大声说出来。