Canadian Sales - Sales By Customer (Group) in Canada

Canadian Sales - Sales By Customer (Group) in Canada

This report displays the trend of the total received, cost, and gross margin per customer per year.

Report Definition

  1. Author

    1. April Dianne Gahuman (Full Scale developer)

  2. Presentation Medium

    1. SSRS Portal

  3. Fields (data)

    1. Year of Invoice Date

      1. Year

    2. Month of Invoice Date

      1. Month Name

      2. Month

    3. Sales By Customer Group in Canada

      1. Customer

      2. Cost

      3. Total Received

      4. Gross Margin

      5. Year

Data Sources

The main data source will be the Tableau_TB_SalesView view in the eiboxoffice database (192.168.10.215).

Data Set

Data Set

 Query

Description

Data Set

 Query

Description

1

YearOfInvoiceDate

SELECT DISTINCT YEAR(sv.InvoiceDate) AS Year FROM [eiboxoffice].[dbo].[Tableau_TB_SalesView] sv WHERE YEAR(sv.InvoiceDate) IS NOT NULL ORDER BY YEAR(sv.InvoiceDate) DESC

This gets the distinct list of years available based on the invoice date to be used as a parameter drop-down.

2

MonthOfInvoiceDate

SELECT DISTINCT DATENAME(MONTH, DATEADD(MONTH, MONTH(sv.InvoiceDate), -1 )) AS MonthName ,MONTH(sv.InvoiceDate) AS Month FROM [eiboxoffice].[dbo].[Tableau_TB_SalesView] sv WHERE MONTH(sv.InvoiceDate) IS NOT NULL ORDER BY MONTH(sv.InvoiceDate)

This gets the distinct list of months available based on the invoice date to be used as a parameter drop-down.

3

SalesByCustomerGroupInCanada

SET NOCOUNT ON; WITH CTE AS ( SELECT sv.Customer ,SUM(sv.Cost) AS Cost ,SUM([Total]-[Cost]) AS GrossMargin ,SUM(sv.Total) AS TotalReceived ,YEAR(sv.InvoiceDate) AS Year FROM [eiboxoffice].[dbo].[Tableau_TB_SalesView] sv WITH(NOLOCK) WHERE YEAR(sv.InvoiceDate) IN (@year) AND MONTH(sv.InvoiceDate) IN (@month) AND IsCancelled = 0 GROUP BY sv.Customer, sv.InvoiceDate ) SELECT Customer ,ROUND(SUM(Cost), 0) AS Cost ,ROUND(SUM(TotalReceived), 0) AS TotalReceived ,ROUND(SUM(GrossMargin), 0) AS GrossMargin ,Year FROM CTE GROUP BY Customer, Year ORDER BY Year, Customer

This gets the data for the customer, cost, gross margin, and total received per year.

Calculations

Column Name

Data Type

Calculation

Column Name

Data Type

Calculation

Gross Margin

money

SUM([Sales]-[Cost])

Filters

Filter Name

Description

Filter Name

Description

Year of Invoice Date

The dropdown values include the distinct list of years based on the invoice date.

Month of Invoice Date

The dropdown values include a distinct list of months.

Screenshot

 

Related content