• Save
B-Project Report-SSAS
Upcoming SlideShare
Loading in...5
×
 

B-Project Report-SSAS

on

  • 2,454 views

 

Statistics

Views

Total Views
2,454
Views on SlideShare
2,442
Embed Views
12

Actions

Likes
1
Downloads
0
Comments
0

4 Embeds 12

http://yubarajkhanal.com 8
http://www.linkedin.com 2
http://www.lmodules.com 1
http://static.slidesharecdn.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    B-Project Report-SSAS B-Project Report-SSAS Document Transcript

    • SetFocus Business Intelligence –Master Program SQL SERVER ANALYSIS SERVICE PORJECT DOCUMENTATION ON AllWorks, Inc. – a Ficticious Construction Company Submitted By Yubaraj Khanal (June, 2009) 0
    • Table of Contents 1. Introduction: ....................................................................................................................................... 3 2. Project Requirements: ........................................................................................................................ 3 3. Project Preparations: .......................................................................................................................... 3 4. Project Tasks: ...................................................................................................................................... 3 4.1. Creating the SSAS Project/Cube .......................................................................................................... 3 4.2. MDX Queries ....................................................................................................................................... 6 4.3. Key Performance Indicators (KPIs) ...................................................................................................... 6 4.3.1. KPI 1: Open Receivables ...................................................................................................................... 6 4.3.2. KPI 2: Job Increase............................................................................................................................... 8 4.3.3. KPI 3: Overhead as percent of Total Cost............................................................................................ 9 4.3.4. KPI 4: Profit Percent .......................................................................................................................... 11 4.3.5. KPI5: Overhead Change Percent ....................................................................................................... 12 5. APPENDIX .......................................................................................................................................... 14 5.1. Retrieve total labor costs by Client ................................................................................................... 14 5.2. Retrieve total labor costs by Client, and filter out any NULL values ................................................. 14 5.3. Retrieve total labor costs by County ................................................................................................. 15 5.4. Retrieve total labor costs by Division ................................................................................................ 15 5.5. Retrieve total labor costs by Client Account grouping...................................................................... 16 5.6. Retrieve 3 meatures…total labor cost, total material cost, and total overhead by client ................ 16 5.7. Do the same (retrieve 3 measures) and add a 4th measure, a calculated measure, that adds all three costs................................................................................................................................................... 17 5.8. Retrieve and calculate the total costs, the total profit, and total profit %, ...................................... 17 5.9. Do the same thing as above, but group it by client .......................................................................... 18 5.10. Display a count of Jobs by client ....................................................................................................... 20 5.11. Retrieve all Clients with a Total Labor cost to date greater than 5,000, and the word 'INC' appears in the client name ......................................................................................................................... 20 5.12. List the jobs that make up the top 30% of total invoice amount...................................................... 21 5.13. Show Overhead by Overhead Category for Q3 and Q4 2005 (hint, use the FY Qtr as a dimension) 21 SSAS Student Project Documentation 1
    • 5.14. Show Overhead by Overhead Category for Q3 and Q4 2005, and also show the % of change between the two......................................................................................................................................... 22 5.15. Show Overhead by Overhead Category for all of 2005, order by Overhead $$ amount descending 23 5.16. Show Material Purchase amounts by Material Type for 2005. ........................................................ 24 5.17. Show Material purchase amounts for 2005, broken out by Material Purchase type and client. ..... 24 5.18. Show a list of total client material purchases for 2005, ................................................................... 25 5.19. Show jobs in order of purchase amount and then show the breakdown in each job of material type. 26 5.20. List Hours Worked and Total Labor for each employee for 2005, along with the labor rate (Total labor / Hours worked). ................................................................................................................................ 27 5.21. Perform the same query as 4.1, except this time, sort the employees by labor rate descending, to see the employees with the highest labor rate at the top. ........................................................................ 28 5.22. For 2005, show Total Hours worked, total labor dollars, and total labor rate for contractors (employee flag is false) and employees (employee flag is true)................................................................. 29 5.23. For 2005, show the job and the top three employees who worked the most hours. ..................... 29 5.24. Show All employees for 2005 Q4, and four periods ago, for total hours worked in the Quarter .... 31 SSAS Student Project Documentation 2
    • 1. Introduction: The project is for a fictitious construction company called AllWorks. The basic requirement of the project is to design and crate a SSAS Application by using data source, data view, relationship, cube, partition, aggregation, calculations and KPIs. There is also a separate part of project as a MDX Workshop. 2. Project Requirements: There are three phases/ deliverables to the SSAS Project:  Creating an SSAS solution in BIDS, and building a cube from the four fact tables. o JobOverheaadSummaryFacts o JobMaterialFacts o JobLoborFacts o JobSummaryFacts  A Workshop on SSAS queries.  Building KPIs. 3. Project Preparations: Following tasks were done before starting the project as an initial preparation according to the project guidelines. 3.1.1.Unzip the file SetFocusBISSASProjects.ZIP to the root of your C: drive – it will unzip to C:SetFocusBIProjectsStudentVersionSSASStudentProject 3.1.2.Unzip the file SSAS_MDX_Project.zip to the root of your C: drive – it will unzip to C:SetFocusBIProjectsStudentVersionSSAS_MDX_Project 3.1.3.Restore the attached ALLWORKS.ZIP file to local server in SQL Server  Unzip/extract ALLWORKS.ZIP (it contains ALLWORKS.BAK inside)  Go into SQL Server Management Studio, connect to database Services using LocalHost  Take the option to restore a database. Call the new database AllWorks, and point to the AllWorks.BAK file 4. Project Tasks: 4.1. Creating the SSAS Project/Cube 4.1.1.An Empty SSAS Project, Stored in c:SetFocusBIProjectsStudentVersionSSASStudentProject was opened. 4.1.2.A Data Source named AllWorksDs.ds was created. 4.1.3.Data Source Views were created using the following tables in the Data Source View: o JobSummaryFacts o JobOverHeadSummaryFacts o JobMaterialFacts o JobLaborFacts SSAS Student Project Documentation 3
    • o AllWorksCalendar o Clients o ClientGroupings o County o Division o Employees o JobMaster o MaterialType o OverHead 4.1.4.In the data source view, following relationship was created:  Allworks Calendar is the target of 4 relationships on Week ending Date from JobOverheadSummaryFacts, JobMaterialFacts, and JobLaborFacts (on week ending date) and JobSummaryFacts (on JobClosedDate)  Employees is the target of a relationship from JobLaborFacts (on EmployeePK)  MaterialTypes is the target of a relationship from JobMaterialFacts (on MaterialTypePK)  Overhead is the target of a relationship from JobOverheadSummaryFacts (on OverheadPK)  JobMasterPK is the target of 4 relationships from JobOverheadSummaryFacts, JobMaterialFacts, JobLaborFacts, and JobSummaryFacts (all on JobMasterPK)  JobMasterPK is related to Clients, on ClientPK  Clients is related to County, which in turn is related to Division (based on CountypK, and DivisionPK)  Clients is related to ClientGroupings, on ClientGroupingPK SSAS Student Project Documentation 4
    • Figure 1:All Works Data Source Relationship 4.1.5.Using the Wizard, cube and dimensions are created and got following results:  One Cube (AllWorks.cube) with four fact tables (JobSummaryFacts, JobOverheadSummaryFacts, JobMaterialFacts and JobLaborFacts)  Five Dimensions1 (JobMaster, Overhead, Material Types, Employees and AllWorksCalendar). 1 According to the requirement document, there should be 6 dimensions, but after the instructions from project instructor, existing relation are deleted before new relations creation; as a result there are only 5 dimensions. SSAS Student Project Documentation 5
    • Figure 2: Cube Layout with Fact and Dimensions 4.1.6.For the JobMaster2 Dimension, the hierarchy for client to county to division and for client to client group is checked and name column properties were set according to the corresponding attributes. 4.1.7.For Each of the four fact tables, two partitions were created- one for data before year 2005 (including year 2005), and another for data after 2005. Data separated by using query- (join with AllWorksCalendar table). Each partitions with data after 2005 were set their aggregation to 50%.3 4.2. MDX Queries As a part of the project, different mdx queries were written and tested according to the project requirements. The details is available in the appendix part of this document. 4.3. Key Performance Indicators (KPIs) Following Five KPIs were created and tested in excel. 4.3.1. KPI 1: Open Receivables Requirements: 2 After change in relationship, client dimension (according to the project requirement) was merged into jobmaster dimension. 3 According to the additional requirements send by the instructor in email. SSAS Student Project Documentation 6
    • Project Open Receivables as a 0 – 10% OK Run for all (“Job”) % of Invoice Amount Clients to Master Greater than 10%, less than or equal Excel, save the Open Receivables = to 20% , warning spreadsheet, Invoice Amount minus Amount Received Greater than 20% – bad Use Traffic Light Calculations:Open Receivables: -- If Invoice Amount is 0, than output will be good, so -1 is used as less than 10% IIF ([Measures].[Invoice Amount]<>0, ([Measures].[Invoice Amount]-[Measures].[Amount Received])/[Measures].[Invoice Amount],-1) KPI1: KPIOpen Receivables --Open receivables as a percentage of invoice amount CASE WHEN KPIValue("KPIOpenReceivables") <= KPIGoal("KPIOpenReceivables") THEN 1 -- For Green Light, If openreceivables is within the goal (0-10%) WHEN KPIValue("KPIOpenReceivables") <= KPIGoal("KPIOpenReceivables") * 2 THEN 0 -- For Yellow Light, If Open Receivables is less than or equals to 20% ELSE -1 -- For Red Light when Open Receivable will be more than 20% END Excel Output: SSAS Student Project Documentation 7
    • Figure 3: Result KPI 1(Open Receivables) 4.3.2. KPI 2: Job Increase Requirements: Project Increase in number of 0 or more is good (meaning we’ve Run for all Clients to nd (“Job”) Jobs from the previous done at least one more Job for this Excel for the 2 Qtr Master quarter to the current quarter than for the last quarter….a of 2006, save the quarter zero means we’ve done at least the spreadsheet, same # of Jobs) (hint: use PrevMember) -1 is bad (we’ve done less Jobs for the client in the current qtr, versus the previous quarter Use Traffic Light Calculations: CurrentJobs ([Measures].[Job Summary Facts Count],[All Works Calendar].[Fy Qtr].CurrentMember) Calculations: PreviousJobs: ([Measures].[Job Summary Facts Count],[All Works Calendar].[Fy Qtr].PrevMember) Calculations: JobIncreases [Measures].[CurrentJobs]-[Measures].[PreviousJobs] KPI:KPINewJobs --For Increase in number of jobs from previous quarter to the SSAS Student Project Documentation 8
    • current quarter. CASE When KPIValue("KPINewJobs")>=0 then 1 --For Green Light --If New jobs for current quarter is more than or equal to 0 from previous quarter. else -1 --For Red Light end Excel Output: Figure 4: Job Increased 4.3.3. KPI 3: Overhead as percent of Total Cost Project Overhead as a % of Total 0 – 10% OK Run For all Jobs to (“Job”) Cost Excel Master Greater than 10%, less than or equal to Save spreadsheet SSAS Student Project Documentation 9
    • (where total cost = Total 15%, Warning Overhead + Total material Cost + Total Labor Cost) Greater than 15% - bad Use Traffic Light Calculations: TotalCost [Measures].[Total Overhead]+[Measures].[Total Material Cost]+[Measures].[Total Labor Cost] Calculation: PctOfTotalCost -- Condition If Total cost is 0, than output will be 0 IIF([Measures].[totalCost]<>0, [Measures].[Total Overhead]/[Measures].[TotalCost],0) KPI: KPIOverHeadPct --Overhead as percentage of total cost CASE WHEN KPIValue("KPIOverHeadPct") <= KPIGoal("KPIOverHeadPct") THEN 1 --Green Light Signal for 0-10%Overhead WHEN KPIValue("KPIOverHeadPct") <= KPIGoal("KPIOverHeadPct") + 0.05 THEN 0 --Yellow Light Signal for greater than 10% and less than or equal to 15% Overhead. ELSE -1 --Red Light Signal for other condition(greater than 15% overhead) END Excel Output SSAS Student Project Documentation 10
    • Figure 5: Overhead Percentage 4.3.4. KPI 4: Profit Percent Project Profit % Less than or equal to 5% is bad Run for all Clients, (“Job”) save the spreadsheet Master Total Profit / Greater than 5%, Less than or to Excel (Total Costs + Total Profit) equal to 15%, warning Total Profit = Total Labor Profit + Greater than 15%, good Total Material Profit + Additional Labor Profit Use Traffic Light Total Costs = Total Labor Cost + Total Material Costs + Total Overhead (hint: you created this as a calculation for KPI3, so you can reuse it) Calculation: TotalCost [Measures].[Total Overhead]+[Measures].[Total Material Cost]+[Measures].[Total Labor Cost] Calculation: TotalProfit [Measures].[Total Labor Profit]+[Measures].[Total Material Profit]+[Measures].[Additional Labor Profit] Calculation: ProfitPercent --Total Cost is 0, then profit will be 100% IIF([Measures].[totalcost]<>0,[Measures].[TotalProfit]/([Measures] .[TotalCost]+[Measures].[TotalProfit]),1) KPI:KPIProfitPercent SSAS Student Project Documentation 11
    • --For Increase in number of jobs from previous quarter to the current quarter. CASE When KPIValue("KPINewJobs")>=0 then 1 --For Green Light --If New jobs for current quarter is more than or equal to 0 from previous quarter. else -1 --For Red Light end Excel Output Figure 6: Profit Percent 4.3.5. KPI5: Overhead Change Percent Project Determine % increase in Less than 10% increase is good Run for each (“Job”) Overhead category from one Between 10% and 15%, warning Overhead Category, Overhead quarter to another Greater than 15%, bad save the spreadsheet to Excel Calculations:CurrentQtrOverhead ([All Works Calendar].[Fy Qtr].currentmember, [Measures].[Weekly Over head]) Calculations: PrevQtrOverhead SSAS Student Project Documentation 12
    • ([All Works Calendar].[Fy Qtr].prevmember,[Measures].[Weekly Over head]) Calculations: OverheadChangePct ---Calculation of overhead change percent --Three Conditions: //1- If Overhead of both quarters (current and previous) is 0, than output will be 0. //2- If overhead of previous quarter is 0, than output will be 100% //3- If overhead of current quarter is 0, than output will be -100% IIF([Measures].[PrevQtrOverhead]=0 and [Measures].[CurrentQtrOverhead]=0,0, IIf([Measures].[PrevQtrOverhead]=0, 1, IIf([Measures].[CurrentQtrOverhead]=0, - 1,(([Measures].[CurrentQtrOverhead]- [Measures].[PrevQtrOverhead])/[Measures].[PrevQtrOverhead]) ))) KPI: KPIOverheadIncrease -Overhead Increase from previous quarter to current quarter CASE WHEN KPIValue("KPIOverHeadIncrease") < KPIGoal("KPIOverHeadIncrease") THEN 1 -- Green Light, If overhead is less than goal. WHEN KPIValue("KPIOverHeadIncrease") < KPIGoal("KPIOverHeadIncrease") + 0.05 THEN 0 -- Yellow Light, If overhead is more than goal but less than goal plus 5%. ELSE -1 --Red Light, other condition, If overhead is more htan goal plus 5% END Excel Output Figure 7: Overhead Increase SSAS Student Project Documentation 13
    • 5. APPENDIX MDX QUERIES EXERCIS 5.1. Retrieve total labor costs by Client SELECT [measures].[total Labor Cost] ON COLUMNS ,[Job Master].[Client Name].MEMBERS ON ROWS FROM AllWorks 5.2. Retrieve total labor costs by Client, and filter out any NULL values SELECT [measures].[total Labor Cost] ON COLUMNS ,NON EMPTY --Filtering for Null Values [Job Master].[Client Name].MEMBERS ON ROWS FROM AllWorks SSAS Student Project Documentation 14
    • 5.3. Retrieve total labor costs by County SELECT [measures].[total Labor Cost] ON COLUMNS ,NON EMPTY -- Filtering Null Values [Job Master].[County Name].MEMBERS ON ROWS FROM AllWorks 5.4. Retrieve total labor costs by Division SELECT [measures].[total Labor Cost] ON COLUMNS ,NON EMPTY --Filtering Null Values [Job Master].[Division Name].MEMBERS ON ROWS FROM AllWorks SSAS Student Project Documentation 15
    • 5.5. Retrieve total labor costs by Client Account grouping SELECT [measures].[total Labor Cost] ON COLUMNS ,NON EMPTY -- Filtering Null Values [Job Master].[Grouping Name].MEMBERS ON ROWS FROM AllWorks; 5.6. Retrieve 3 meatures…total labor cost, total material cost, and total overhead by client SELECT { [measures].[total Labor Cost] ,[Measures].[Total Material Cost] ,[Measures].[Total Overhead] } ON COLUMNS ,NON EMPTY -- Filering Null Values [Job Master].[Client Name].MEMBERS ON ROWS FROM AllWorks SSAS Student Project Documentation 16
    • 5.7. Do the same (retrieve 3 measures) and add a 4th measure, a calculated measure, that adds all three costs WITH MEMBER [Measures].[AllCosts] AS -- Calculating All Costs [measures].[total Labor Cost] + [Measures].[Total Material Cost] + [total Overhead] SELECT { [measures].[total Labor Cost] ,[Measures].[Total Material Cost] ,[Measures].[Total Overhead] ,[Measures].[AllCosts] } ON COLUMNS ,NON EMPTY --Filtering Null Values [Job Master].[Client Name].MEMBERS ON ROWS FROM AllWorks 5.8. Retrieve and calculate the total costs, the total profit, and total profit %, WITH MEMBER [Measures].[TotalCosts] AS --Calculating Total Costs [measures].[total Labor Cost] + [Measures].[Total Material Cost] + [total Overhead] MEMBER [Measures].[TotalProfit] AS -- Calculating Total Profit [Measures].[Total Labor Profit] + [Measures].[Total Material Profit] + [Measures].[Additional Labor Profit] SSAS Student Project Documentation 17
    • MEMBER [Measures].[ProfitPct] AS --Calculating Profit Percentage [Measures].[TotalProfit]/([Measures].[TotalCosts] + [Measures].[TotalProfit]) ,Format_String = 'Percent' --Formating with percentage SELECT { [Measures].[TotalCosts] ,[Measures].[TotalProfit] ,[Measures].[ProfitPct] } ON COLUMNS ,NON EMPTY -- Filtering Null Values Filter( -- Filtering records with Total Cost= 0 (Divide by 0) [Job Master].[Description].MEMBERS ,[Measures].[TotalCosts]<>0) ON ROWS FROM AllWorks; 5.9. Do the same thing as above, but group it by client WITH MEMBER [Measures].[TotalCosts] AS --Calculating Total Costs [measures].[total Labor Cost] + [Measures].[Total Material Cost] + [total Overhead] MEMBER [Measures].[TotalProfit] AS -- Calculating Total Profit SSAS Student Project Documentation 18
    • [Measures].[Total Labor Profit] + [Measures].[Total Material Profit] + [Measures].[Additional Labor Profit] MEMBER [Measures].[ProfitPct] AS --Calculating Profit Percentage [Measures].[TotalProfit]/([Measures].[TotalCosts] + [Measures].[TotalProfit]) ,Format_String = 'Percent' --Formating with percentage SELECT { [Measures].[TotalCosts] ,[Measures].[TotalProfit] ,[Measures].[ProfitPct] } ON COLUMNS ,NON EMPTY -- Filtering Null Values Filter( -- Filtering records with Total cost= 0 (Divide by 0) [Job Master].[Client Name].members ,[Measures].[TotalCost]<>0) ON ROWS FROM AllWorks; SSAS Student Project Documentation 19
    • 5.10. Display a count of Jobs by client SELECT [Measures].[Job Summary Facts Count] ON COLUMNS ,[Job Master].[Client Name].MEMBERS ON ROWS FROM AllWorks 5.11. Retrieve all Clients with a Total Labor cost to date greater than 5,000, and the word 'INC' appears in the client name WITH SET [ClientMeasureset] AS Filter -- Filtering clients with 2 conditions ( [Job Master].[Client Name].Children , [Measures].[Total Labor Cost] > 5000 -- Condition1: Labor Cost is greater than 5000 AND Instr -- Condition 2: Workd 'INC' appears in Client Name ( [Job Master].[Client Name].CurrentMember.MemberValue ,'INC' ) ) SELECT [Measures].[Total Labor Cost] ON COLUMNS ,[ClientMeasureset] ON ROWS FROM AllWorks SSAS Student Project Documentation 20
    • 5.12. List the jobs that make up the top 30% of total invoice amount SELECT [Measures].[Invoice Amount] ON COLUMNS ,TopPercent -- To retrive top 30% values ( [Job Master].[Description].Children ,30 ,[Measures].[Invoice Amount] ) ON ROWS FROM AllWorks 5.13. Show Overhead by Overhead Category for Q3 and Q4 2005 (hint, use the FY Qtr as a dimension) SELECT { [All Works Calendar].[Fy Qtr].&[2005 Q3] ,[All Works Calendar].[Fy Qtr].&[2005 Q4] } ON COLUMNS ,[Overhead].[Description].MEMBERS ON ROWS FROM AllWorks WHERE [Measures].[Weekly Over Head] SSAS Student Project Documentation 21
    • 5.14. Show Overhead by Overhead Category for Q3 and Q4 2005, and also show the % of change between the two WITH MEMBER [Measures].[PrevOverhead] AS -- Finding Previous Quarter Overhead ( [Measures].[Weekly Over Head] ,[All Works Calendar].[Fy Qtr].PrevMember ) , Format_String='Currency'--Formating Output with Currency MEMBER [Measures].[CurrentOverhead] AS -- Finding Current Quarter Overhead ( [Measures].[Weekly Over Head] ,[All Works Calendar].[Fy Qtr].CurrentMember ) , Format_String='Currency'--Formating Output with Currency MEMBER [Measures].[%ofChange] AS --Finding Percentage Change IIF -- Checking Previous Quarter Overhead, IF 0, than output 'N/A', else calculate percent (Divide by 0) ( [Measures].[PrevOverhead] <> 0 , ([Measures].[CurrentOverhead] - [Measures].[PrevOverhead]) / [Measures].[PrevOverhead] ,'N/A' SSAS Student Project Documentation 22
    • ) ,Format_String = 'Percent' --Formating output by percent SELECT { [Measures].[PrevOverhead] ,[Measures].[CurrentOverhead] ,[Measures].[%ofChange] } ON COLUMNS ,[Overhead].[Description].MEMBERS ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Qtr].&[2005 Q4] 5.15. Show Overhead by Overhead Category for all of 2005, order by Overhead $$ amount descending SELECT [Measures].[Weekly Over Head] ON COLUMNS, ORDER ([Overhead].[Description].members, [Measures].[Weekly Over Head], desc) ON ROWS FROM AllWorks Where [All Works Calendar].[Fy Year].&[2005] SSAS Student Project Documentation 23
    • 5.16. Show Material Purchase amounts by Material Type for 2005. SELECT [Measures].[Purchase Amount] ON COLUMNS ,NON EMPTY -- Filtering Non Empty Values [Material Types].[Description].MEMBERS ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005] 5.17. Show Material purchase amounts for 2005, broken out by Material Purchase type and client. SELECT [Measures].[Purchase Amount] ON COLUMNS ,NON EMPTY -- Filtering records with null SSAS Student Project Documentation 24
    • ( [Material Types].[Description].Children ,[Job Master].[Client Name].Children ) ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005] 5.18. Show a list of total client material purchases for 2005, SELECT [Measures].[Purchase Amount] ON COLUMNS , Non Empty( -- Eliminating Null Values Order -- Sorting Purchase Order ( [Job Master].[Client Name].Children ,[Measures].[Purchase Amount] ,desc -- Setting Sort Order to Descending )) ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005]; SSAS Student Project Documentation 25
    • 5.19. Show jobs in order of purchase amount and then show the breakdown in each job of material type. SELECT [Measures].[Purchase Amount] ON COLUMNS ,NON EMPTY -- Eliminating Null Values Order -- Sorting the result with descending order ( [Job Master].[Description].Children ,[Measures].[Purchase Amount] ,bdesc ) * [Material Types].[Description].MEMBERS ON ROWS FROM AllWorks SSAS Student Project Documentation 26
    • 5.20. List Hours Worked and Total Labor for each employee for 2005, along with the labor rate (Total labor / Hours worked). WITH MEMBER [Measures].[Labor Rate] AS -- Calculating Labor Rate [Measures].[total Labor] / [Measures].[Hoursworked] ,Format_String = 'Currency' --Formating Output with Currency SELECT { [Measures].[Hoursworked] ,[Measures].[Total Labor] ,[Measures].[Labor Rate] } ON COLUMNS ,NON EMPTY -- Eliminating Null Values [Employees].[Full Name].MEMBERS ON ROWS SSAS Student Project Documentation 27
    • FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005] 5.21. Perform the same query as 4.1, except this time, sort the employees by labor rate descending, to see the employees with the highest labor rate at the top. WITH MEMBER [Measures].[Labor Rate] AS -- Calculating Labor Rate [Measures].[total Labor] / [Measures].[Hoursworked] ,Format_String = 'Currency' -- Formating Output with Currency SELECT { [Measures].[Hoursworked] ,[Measures].[Total Labor] ,[Measures].[Labor Rate] } ON COLUMNS ,NON EMPTY -- Eliminating Null Values Order -- Sorting Employee with Order Rate in descending Order ( [Employees].[Full Name].MEMBERS ,[Measures].[Labor Rate] ,bdesc ) ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005]; SSAS Student Project Documentation 28
    • 5.22. For 2005, show Total Hours worked, total labor dollars, and total labor rate for contractors (employee flag is false) and employees (employee flag is true) WITH MEMBER [Measures].[Labor Rate] AS -- Calculating Labor Rate [Measures].[total Labor] / [Measures].[Hoursworked] ,Format_String = 'Currency' -- Formating Output as Currency SELECT { [Measures].[Hoursworked] ,[Measures].[Total Labor] ,[Measures].[Labor Rate] } ON COLUMNS ,NON EMPTY -- Eliminating Empty Values [Employees].[Employee Flag].MEMBERS ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005] 5.23. For 2005, show the job and the top three employees who worked the most hours. SSAS Student Project Documentation 29
    • SELECT [Measures].[Hoursworked] ON COLUMNS ,NON EMPTY -- Eliminating Null Values Generate --Making jobs in order with topcount result ( [Job Master].[Description].Children ,TopCount -- To Show top 3 employees in related job. ( [Job Master].[Description].CurrentMember * [Employees].[Full Name].Children ,3 ,[Measures].[HoursWorked] ) ) ON ROWS FROM AllWorks WHERE [All Works Calendar].[Fy Year].&[2005] SSAS Student Project Documentation 30
    • 5.24. Show All employees for 2005 Q4, and four periods ago, for total hours worked in the Quarter SELECT { ParallelPeriod -- Using Parallelperiod to find Four period ago ( [All Works Calendar].[Fy Qtr].[Fy Qtr] ,4 ,[All Works Calendar].[Fy Qtr].&[2005 Q4] ) ,[All Works Calendar].[Fy Qtr].&[2005 Q4] } ON COLUMNS ,[Employees].[Full Name].Children ON ROWS FROM AllWorks WHERE [Measures].[Hoursworked] SSAS Student Project Documentation 31