简体   繁体   中英

SSRS show sales data per week days

I need to create a report which would show sales by department by week day in the following format:

Department  Mon Tue Wed Thu Fri Sat Sun 
Dep1
Dep2
Dep3

Currently data is in list format and my current query is

SELECT
sales_reporting_view.department_name
,sales_reporting_view.created_date
,sales_reporting_view.sales_spti
FROM
sales_reporting_view

I have looked around and one of the solutions is to use Pivot function but I failed to make it work for my example as I'm quiet new to SSRS. Any suggestions would be appreciated.

You could PIVOT the SQL query and then just create a simple SSRS report, or if you want to keep the pivoting/formatting in SSRS you should use a Matrix.

For the Matrix use the Department as your "Rows" input. Use FORMAT(created_date, "ddd") as your "Columns" input. And use sales_spti as your "Data" input.

You can sort the columns using DAYOFWEEK(created_date), which would order them Monday(1) through Sunday(7). See SSRS Date functions for further info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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