0

I am trying to make a bar graph that displays the total units a sales person made and display it in Mobile Report Publisher; EX:

Tim -----

Blake ---

Chad -

Greg --------

My query is simple:

SELECT t.Sales_rep, COUNT(t.Sales_rep) as counted
FROM table as t
GROUP BY t.Sales_rep

I am having no problem getting data into mobile report publisher.

And this is the result: layout of the graph

As one can see, none of the numbers are being put in.

If I change the query to:

SELECT t.Sales_rep, 1 as counted
FROM table as t

And let Mobile Report Publisher do the aggregation, I still get the same result.

If I try to switch Data Structure from By Rows to By Columns I get this: with data structure as by columns

If I add any other columns, I get the same results posted above.

4

1 回答 1

1

您只是使用了错误的查询吗?我在 SQL Server 中创建了一个表:

CREATE TABLE [dbo].[Sales] (
    [Id] INT NOT NULL,
    [Sales_rep] VARCHAR (50) NULL,
    [Units]     INT   NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

并将其填充如下:

填充销售表

然后使用以下 TSQL 创建数据集:

SELECT 
    t.[Sales_rep], 
    SUM(t.[Units]) 
FROM 
    [dbo].[Sales] t 
GROUP BY 
    t.[Sales_rep]

然后,我创建了一个移动报表,将总计图表添加到主区域,并将其数据设置为使用上述数据集及其属性,如下所示:

销售属性

这给了我以下图表输出,我认为这是您想要的:

输出

希望这可以帮助。

马丁

于 2016-09-12T21:44:46.847 回答