我有一个查询,该查询当前拉回特定财务年度中销售人员的销售清单。这已经部署在SSRS中;现在,我想添加一个图表来显示这些销售额,但是由于有10,000多名销售人员,因此我想将图表限制在TOP N销售额(按收入)。
我希望不必更改查询或结果集。
图形当前如下所示:
当前查询如下:
SELECT
EMPD.emp_name,
SUM(ISNULL(CID.menu_item_sales_amount,0)) AS [Amount]
FROM ig_Business..Check_Item_Detail CID (NOLOCK) -- sum of sales by emp id
JOIN ig_Transaction..Transaction_Master TM (NOLOCK) on tm.transaction_data_id = cid.transaction_data_id AND tm.ent_id = 1 -- ent_id 1 equals not test data
JOIN ig_business..Check_Sales_Detail CSD (NOLOCK) ON CSD.transaction_data_id = CID.transaction_data_id -- tender period is stored here
JOIN ig_Dimension..Employee_Dimension EMPD (NOLOCK) ON CID.emp_dim_id = EMPD.emp_dim_id -- so we can get employee name
JOIN ig_Dimension..Menu_Item_Dimension MID (NOLOCK) on MID.menu_item_dim_id = CID.menu_item_dim_id and MID.ent_id = 1
JOIN ig_Dimension..Check_Type_Dimension CTD (NOLOCK) on CTD.check_type_dim_id = CSD.check_type_dim_id
/* Date Range Changed Below */
WHERE (
tm.updated_date_time BETWEEN @startdatecast AND @enddatecast
)
AND MID.report_category_id in (2,25,73,33,81,84,1,14)
AND CID.menu_item_status = 0
AND CTD.check_type_id in (1,5,7,10,9,12,13,14,15,16,17,20,21,22,23,24,25,27,28,29,30,31,33,34)
AND EMPD.emp_name NOT IN ('REUSE, REUSE','Trial3, Test','Trial, Trial','Test, Trial')
GROUP BY EMPD.emp_name
ORDER by [Amount] DESC,EMPD.emp_name
答案 0 :(得分:0)
将过滤器添加到类别组,例如:
expression = [sum(Amount)]
operator = Top N
Value = 10