Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Calculated Fields 
Ram Kedem
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Calc...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Basi...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Creating Basi...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Sort By Calcu...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Conditional F...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Conditional F...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Concatenating...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Text Function...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Text Function...
Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com 
Date Function...
Upcoming SlideShare
Loading in …5
×

SSRS Calculated Fields

658 views

Published on

SSRS Calculated Fields

Published in: Technology
  • Be the first to comment

  • Be the first to like this

SSRS Calculated Fields

  1. 1. Calculated Fields Ram Kedem
  2. 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. 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. 4. Copyright 2014 © Ram Kedem. All rights reserved. Not to be reproduced without written consent. ramkedem.com Creating Basic Calculated Field(VAT)
  5. 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. 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. 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. 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. 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. 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. 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())

×