SlideShare une entreprise Scribd logo
1  sur  11
Calculated Fields 
Ram Kedem
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Calculated Columns 
•Creating Calculated Columns 
•Expression Builder 
•Basic Arithmetic 
•Conditional Functions 
•Calculations with Text 
•Calculation with Dates
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Basic Calculated Field 
Used Query 
SELECTproductID, ProductName, UnitPrice, UnitPrice* 1.18 AS UnitPriceVAT 
FROMproducts
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Basic Calculated Field(VAT)
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Sort By Calculated Column (or any other column)
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Conditional Functions (IF) 
•Simple 
=IIf(Fields!VAT.Value>5, "High" , "Low") 
•Complex 
=IIf(Fields!VAT.Value>0 AND Fields!VAT.Value<3, “1-3" , IIf(Fields!VAT.Value>3 AND Fields!VAT.Value<=6 , “3-6" , "Other Range"))
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Conditional Functions (SWITCH) 
•Basic 
=Switch(Fields!UnitPrice.Value<20, "Low", Fields!UnitPrice.Value< 40 , "Medium" , Fields!UnitPrice.Value< 100 , "High") 
•Using ELSE 
=Switch(Fields!UnitPrice.Value<20, "Low", Fields!UnitPrice.Value< 40 , "Medium" , Fields!UnitPrice.Value< 60 , "High", TRUE , "Very High")
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Concatenating Text 
=Fields!ProductName.Value& " Price is " & Fields!DIFF_UP_CHECK.Value
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Text Functions 
•Using Left / Instrin order to divide full name into first name and last name : 
•SSMS 
•SELECTlastname+ ' ' + firstNameAS FULLNAME 
INTOFullNameList 
FROMemployees 
•SELECTFULLNAME, charindex( ' ' ,FULLNAME )- 1 FROMFullNameList 
•SELECTLEFT(FULLNAME , charindex( ' ' ,FULLNAME )-1) AS lastNameFROMFullNameList 
•SELECTRIGHT(FULLNAME , LEN(fullname) - charindex( ' ' ,FULLNAME ) ) AS FirstNameFROMFullNameList
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Text Functions 
•SSRS 
•=Left(Fields!FULLNAME.Value, InStr(Fields!FULLNAME.Value, " ")-1) 
•=Right(Fields!FULLNAME.Value, Len(Fields!FULLNAME.Value) - InStr(Fields!FULLNAME.Value, " "))
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Date Functions 
•=Month(Fields!BirthDate.Value) 
•=MonthName(Month(Fields!BirthDate.Value)) 
•=DateDiff(DateInterval.Year, Fields!BirthDate.Value, Today())

Contenu connexe

Tendances (8)

Control Flow Using SSIS
Control Flow Using SSISControl Flow Using SSIS
Control Flow Using SSIS
 
Power Pivot and Power View
Power Pivot and Power ViewPower Pivot and Power View
Power Pivot and Power View
 
SSIS Data Flow Tasks
SSIS Data Flow Tasks SSIS Data Flow Tasks
SSIS Data Flow Tasks
 
SSIS Basic Data Flow
SSIS Basic Data FlowSSIS Basic Data Flow
SSIS Basic Data Flow
 
Data mining In SSAS
Data mining In SSASData mining In SSAS
Data mining In SSAS
 
Best Practices for Incredible Web Typography
Best Practices for Incredible Web TypographyBest Practices for Incredible Web Typography
Best Practices for Incredible Web Typography
 
Speed your Rails app creation with templates
Speed your Rails app creation with templatesSpeed your Rails app creation with templates
Speed your Rails app creation with templates
 
Dynamics 365 Field Service - Hidden Gems
Dynamics 365 Field Service - Hidden GemsDynamics 365 Field Service - Hidden Gems
Dynamics 365 Field Service - Hidden Gems
 

Similaire à SSRS Calculated Fields

e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
 
Stackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for EverybodyStackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for Everybody
Cory Forsyth
 

Similaire à SSRS Calculated Fields (19)

Pig - Processing XML data
Pig - Processing XML dataPig - Processing XML data
Pig - Processing XML data
 
2 designing tables
2 designing tables2 designing tables
2 designing tables
 
e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueries
 
Les02
Les02Les02
Les02
 
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
 
Incredible ODI tips to work with Hyperion tools that you ever wanted to know
Incredible ODI tips to work with Hyperion tools that you ever wanted to knowIncredible ODI tips to work with Hyperion tools that you ever wanted to know
Incredible ODI tips to work with Hyperion tools that you ever wanted to know
 
Data Mining in SSAS
Data Mining in SSASData Mining in SSAS
Data Mining in SSAS
 
Data Warehouse Basics
Data Warehouse BasicsData Warehouse Basics
Data Warehouse Basics
 
Les06
Les06Les06
Les06
 
Data Warehouse Design Considerations
Data Warehouse Design ConsiderationsData Warehouse Design Considerations
Data Warehouse Design Considerations
 
4 execution plans
4 execution plans4 execution plans
4 execution plans
 
html 4
html 4html 4
html 4
 
MySQL basics
MySQL basicsMySQL basics
MySQL basics
 
LAB PHP Consolidated.ppt
LAB PHP Consolidated.pptLAB PHP Consolidated.ppt
LAB PHP Consolidated.ppt
 
Stackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for EverybodyStackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for Everybody
 
Refactoring Infrastructure Code
Refactoring Infrastructure CodeRefactoring Infrastructure Code
Refactoring Infrastructure Code
 
SQL Injections - Oracle
SQL Injections - OracleSQL Injections - Oracle
SQL Injections - Oracle
 
3 indexes
3 indexes3 indexes
3 indexes
 
Optimizer overviewoow2014
Optimizer overviewoow2014Optimizer overviewoow2014
Optimizer overviewoow2014
 

Plus de Ram Kedem (12)

Impala use case @ edge
Impala use case @ edgeImpala use case @ edge
Impala use case @ edge
 
Advanced SQL Webinar
Advanced SQL WebinarAdvanced SQL Webinar
Advanced SQL Webinar
 
Managing oracle Database Instance
Managing oracle Database InstanceManaging oracle Database Instance
Managing oracle Database Instance
 
DDL Practice (Hebrew)
DDL Practice (Hebrew)DDL Practice (Hebrew)
DDL Practice (Hebrew)
 
DML Practice (Hebrew)
DML Practice (Hebrew)DML Practice (Hebrew)
DML Practice (Hebrew)
 
Exploring Oracle Database Architecture (Hebrew)
Exploring Oracle Database Architecture (Hebrew)Exploring Oracle Database Architecture (Hebrew)
Exploring Oracle Database Architecture (Hebrew)
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
 
Deploy SSRS Project - SQL Server 2014
Deploy SSRS Project - SQL Server 2014Deploy SSRS Project - SQL Server 2014
Deploy SSRS Project - SQL Server 2014
 
Deploy SSIS
Deploy SSISDeploy SSIS
Deploy SSIS
 
MSSQL Server - Automation
MSSQL Server - AutomationMSSQL Server - Automation
MSSQL Server - Automation
 
Lesson 5 security
Lesson 5   securityLesson 5   security
Lesson 5 security
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

SSRS Calculated Fields

  • 2. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Creating Calculated Columns •Creating Calculated Columns •Expression Builder •Basic Arithmetic •Conditional Functions •Calculations with Text •Calculation with Dates
  • 3. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Creating Basic Calculated Field Used Query SELECTproductID, ProductName, UnitPrice, UnitPrice* 1.18 AS UnitPriceVAT FROMproducts
  • 4. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Creating Basic Calculated Field(VAT)
  • 5. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Sort By Calculated Column (or any other column)
  • 6. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Conditional Functions (IF) •Simple =IIf(Fields!VAT.Value>5, "High" , "Low") •Complex =IIf(Fields!VAT.Value>0 AND Fields!VAT.Value<3, “1-3" , IIf(Fields!VAT.Value>3 AND Fields!VAT.Value<=6 , “3-6" , "Other Range"))
  • 7. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Conditional Functions (SWITCH) •Basic =Switch(Fields!UnitPrice.Value<20, "Low", Fields!UnitPrice.Value< 40 , "Medium" , Fields!UnitPrice.Value< 100 , "High") •Using ELSE =Switch(Fields!UnitPrice.Value<20, "Low", Fields!UnitPrice.Value< 40 , "Medium" , Fields!UnitPrice.Value< 60 , "High", TRUE , "Very High")
  • 8. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Concatenating Text =Fields!ProductName.Value& " Price is " & Fields!DIFF_UP_CHECK.Value
  • 9. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Text Functions •Using Left / Instrin order to divide full name into first name and last name : •SSMS •SELECTlastname+ ' ' + firstNameAS FULLNAME INTOFullNameList FROMemployees •SELECTFULLNAME, charindex( ' ' ,FULLNAME )- 1 FROMFullNameList •SELECTLEFT(FULLNAME , charindex( ' ' ,FULLNAME )-1) AS lastNameFROMFullNameList •SELECTRIGHT(FULLNAME , LEN(fullname) - charindex( ' ' ,FULLNAME ) ) AS FirstNameFROMFullNameList
  • 10. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Text Functions •SSRS •=Left(Fields!FULLNAME.Value, InStr(Fields!FULLNAME.Value, " ")-1) •=Right(Fields!FULLNAME.Value, Len(Fields!FULLNAME.Value) - InStr(Fields!FULLNAME.Value, " "))
  • 11. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Date Functions •=Month(Fields!BirthDate.Value) •=MonthName(Month(Fields!BirthDate.Value)) •=DateDiff(DateInterval.Year, Fields!BirthDate.Value, Today())