Friday, 4 November 2011

SWITCH

Ok so a quick one here:

Want to change a property in SSRS based on the value of a field in your dataset/paramater?

Here's how:


=SWITCH(Fields!month_delta.Value > "SOME VALUE" , "Green",
Fields!month_delta.Value < "SOME VALUE", "Red")

This will accept all logical operators and you can add as many as you like, they resolve in order if there is any logical overlap though

Happy highlighting

:-)

Thursday, 25 August 2011

SSAS 2008

Just back from a SQL 2008 SSAS course and hav to say, im impressed.

Expect some examples soon!

Its been busy here and i have plenty of material to write up, especialy around full text search :-)

T

Tuesday, 5 July 2011

sp_who2 or the "What the heck is going on" Post

Ahh back from my break and time for a very quick gem:

One on my only gripes about SQL Server 2008 is the new activity monitor,
its swish, it has filters but the layout and format is... less than desireable for those of us with small screens.

Run sp_who or sp_who2 on your box and be amazed by the wealth of usefull  information that is returned by your system in a nice tabular format. No EXEC is needed.

Its great for identifying what (and whome!) is causing your environment to run slowly as well as highlighting any blocks that are occuring.

If you havent used it yet, give it a shot, then next time you find yourself wondering  "what the heck is going on on the system" you will know where to turn...

Oh and Microsoft: Please sort this out in Denali!

Tuesday, 7 June 2011

SSRS: Conditional formatting - Using an expression to change chart colour

Dashboards and reports can get very crowded, very quickly and getting meaning full insight from the charts presented, can be a challenge.

In steps conditional formatting!...

In this example i will skip over how you can draw attention to key bits of information in your graphs/charts, but the principle can be applied almost everywhere.

Example:
Here in Pic 1 is a chart mapping the registrations to an online website.
As you can see, it's all over the place and isn't telling us much more than volumes

Pic 1 - My Chart

By dropping into the design and right clicking on the series we want to format (in this example its the registrations) we can then click through to edit the Series Properties:
Pic 2 - Chart in Design
Under the "Fill" tab select  the "Solid" radio button in the top half, then the fx  button next to colour:
Pic 3 - Series Options

In the Expression now we are going to use an IIF statement to decide what colours to use.
If you want something to be either one colour or another, the IIF statement probably suits your needs, howether if you need to put in multiple criteria or ranges, look up the switch function as this probably better suits your needs.

In my example though, I want to highlight the weekends a different colour to weed days as I belive they have different patterns of registration.
To go this I query day_name.value and where it is "Saturday" or "Sunday" then I ask it to be Orange, else I want it to be MidnightBlue.

The expressions format can be seen in pic 4 below:
Pic 4 - Expression Builder
Now this has been set, when I next render the report, I am met with a chart that has much more meaning when looking at it:

Pic 5 - Final Chart
By hilighting the weekends, it allows the viewer to build up a much clearer picture of what is going on.

I hope that was helpfull, there are much more worthy causes out there, but this meant to make you aware of what you can do, for you to then go on and adapt!

T

Monday, 6 June 2011

Cloud Bubble

A close friend of mine who just so happens to be a talented programmer has released his blog : http://www.cloudbubble.co.uk/

I am hoping to work with him on this project as we explore Microsoft's BI offerings, offering step by step tutorials and real world examples...

See you there,

T

Thursday, 2 June 2011

SQL MERGE function...

All of us who have used databases have come accross scenarios that would have been made easier if the MERGE function was avaliable from the start...

It allows you to target a table with some data, and either update it if it allready exists or insert if it doesnt (or any other logic in between)!

Check it out here: http://technet.microsoft.com/en-us/library/bb510625.aspx

(Now is probably a good time to look at Common Table Expressions too! (CTE's))

Enjoy,

T

Tuesday, 24 May 2011

TechEd America 2011

Just a quick post to point out the great online resource avaliable at TechEd 2011 America

This has some presentations on the latest outputs and thoughts from Microsoft and has some great downloadable content.

Looking forward to going to TechEd 2012 Europe in Amsterdam next year (Subject to getting it signed up!)

Tuesday, 3 May 2011

Useful Postcode Sector Code Snippet

Thanks to a work mate for this one:

In the UK our postcodes are formatted in quite a neat way.

We often have the need to aggregate up data to different geographic area as the following code makes this simple!

Snippet:
UPDATE <Table>
SET postcode_sector = (LEFT(Postcode, 1) -- First character will always be a char
                                       + CASE ISNUMERIC(SUBSTRING(Postcode, 2,1)) -- Check 2nd character to see if its numeric
                                                      WHEN 1 THEN '' -- If its numeric add nothing
                                                       ELSE SUBSTRING(Postcode, 2,1) -- Otherwise add the second character
                                           END)

This then allows you to aggregate data to the following levels:

Region Description Postcode Sector
EAST MIDLANDSCambridgeCB
EAST MIDLANDSColchesterCO
EAST MIDLANDSDerbyDE
EAST MIDLANDSDoncasterDN
EAST MIDLANDSIpswichIP
EAST MIDLANDSLeicesterLE
EAST MIDLANDSLincolnLN
EAST MIDLANDSNorwichNR
EAST MIDLANDSNottinghamNG
EAST MIDLANDSPeterboroughPE
EAST MIDLANDSSheffieldS
GREATER LONDONBromleyBR
GREATER LONDONCroydonCR
GREATER LONDONDartfordDA
GREATER LONDONEnfieldEN
GREATER LONDONHarrowHA
GREATER LONDONIlfordIG
GREATER LONDONKingston upon ThamesKT
GREATER LONDONLondon EE
GREATER LONDONLondon ECEC
GREATER LONDONLondon NN
GREATER LONDONLondon NWNW
GREATER LONDONLondon SESE
GREATER LONDONLondon SWSW
GREATER LONDONLondon WW
GREATER LONDONLondon WCWC
GREATER LONDONRomfordRM
GREATER LONDONSouthallUB
GREATER LONDONSuttonSM
GREATER LONDONTwickenhamTW
GREATER LONDONWatfordWD
NORTH EASTClevelandTS
NORTH EASTDarlingtonDL
NORTH EASTDurhamDH
NORTH EASTHarrogateHG
NORTH EASTHullHU
NORTH EASTLeedsLS
NORTH EASTNewcastleNE
NORTH EASTSunderlandSR
NORTH EASTWakefieldWF
NORTH EASTYorkYO
NORTH WESTBlackburnBB
NORTH WESTBlackpoolFY
NORTH WESTBoltonBL
NORTH WESTBradfordBD
NORTH WESTCarlisleCA
NORTH WESTChesterCH
NORTH WESTCreweCW
NORTH WESTHalifaxHX
NORTH WESTHuddersfieldHD
NORTH WESTLancasterLA
NORTH WESTLiverpoolL
NORTH WESTManchesterM
NORTH WESTOldhamOL
NORTH WESTPrestonPR
NORTH WESTStockportSK
NORTH WESTWarringtonWA
NORTH WESTWiganWN
NORTHERN IRELANDBelfastBT
SCOTLANDAberdeenAB
SCOTLANDDumfriesDG
SCOTLANDDundeeDD
SCOTLANDEdinburghEH
SCOTLANDFalkirkFK
SCOTLANDGalashielsTD
SCOTLANDGlasgowG
SCOTLANDInvernessIV
SCOTLANDKilmarnockKA
SCOTLANDKirkaldyKY
SCOTLANDKirkwallKW
SCOTLANDMotherwellML
SCOTLANDPaisleyPA
SCOTLANDPerthPH
SOUTH EASTBrightonBN
SOUTH EASTCanterburyCT
SOUTH EASTChelmsfordCM
SOUTH EASTGuilfordGU
SOUTH EASTHemel HempsteadHP
SOUTH EASTLutonLU
SOUTH EASTMedwayME
SOUTH EASTMilton KeynesMK
SOUTH EASTOxfordOX
SOUTH EASTPortsmouthPO
SOUTH EASTReadingRG
SOUTH EASTRedhillRH
SOUTH EASTSloughSL
SOUTH EASTSouthamptonSO
SOUTH EASTSouthend on SeaSS
SOUTH EASTSt. AlbansAL
SOUTH EASTStevenageSG
SOUTH EASTTonbridgeTN
SOUTH WESTBathBA
SOUTH WESTBournemouthBH
SOUTH WESTBristolBS
SOUTH WESTDorchesterDT
SOUTH WESTExeterEX
SOUTH WESTGloucesterGL
SOUTH WESTPlymouthPL
SOUTH WESTSalisburySP
SOUTH WESTSwindonSN
SOUTH WESTTauntonTA
SOUTH WESTTorquayTQ
SOUTH WESTTruroTR
UNKNOWNUNKNOWNNULL
WALESCardiffCF
WALESLlandrindodLD
WALESLlandudnoLL
WALESNewportNP
WALESShrewsburySY
WALESSwanseaSA
WEST MIDLANDSBirminghamB
WEST MIDLANDSCoventryCV
WEST MIDLANDSDudleyDY
WEST MIDLANDSHerefordHR
WEST MIDLANDSNorthamptonNN
WEST MIDLANDSStoke on TrentST
WEST MIDLANDSTelfordTF
WEST MIDLANDSWalsallWS
WEST MIDLANDSWolverhamptonWV
WEST MIDLANDSWorcesterWR

Hope its of some use!