williamweber.net
  • Home
  • About
  • Minnebar 2013 Wrap-Up

    Last Saturday I attended my first Minnebar, a local BarCamp style event for technology geeks of all shapes and sizes here in the Twin Cities. My original goal was to attend a [...]

    Read more
  • Thoughts on Killzone 3 Multiplayer Go...
    killzone3

    A few days ago I read that Killzone 3 would be offering up it’s multiplayer component free of charge with progress limitations and a $15 price tag to acquire the full e [...]

    Read more
  • A Game Funding Revolution
    A Game Funding Revolution

    Earlier this month the game Double Fine (the development studio headed by Tim Schafer) started a Kickstarter project with the goal of developing a classic point-and-click adv [...]

    Read more
  • Named Set Sub-totals in Excel using V...
    Named Set Sub-totals in Excel using VisualTotals()

    This is just a quick tip for fixing the default Analysis Services (SSAS) named set sub-total behavior in Excel 2010. Normally when you select a named set for the rows or colu [...]

    Read more
  • New Camera Please. – Mirrorless...
    Olympus OM-D E-M5

    A few years ago my wife and I upgraded our intro-model DSLR camera for a mid-range one (Nikon D60 to the Nikon D90). We’ve really enjoyed the camera and looking at our [...]

    Read more
  • Formatting Map Legends in SQL Server ...
    Formatting Map Legends in SQL Server 2008 R2 Reporting Services

    Recently I needed to do some slightly more advanced formatting of a map legend in SQL Server 2008 R2 Reporting Services (SSRS). I love the map reports you can build with SSRS [...]

    Read more
  • MDX: Scope Statement For All Measures...

    This was irritating me today so I thought I would share. If you need to write a scope statement that will include all the measures in multiple measure groups; perhaps youR [...]

    Read more
  • Startup Frenzy Is Out of Control

    A recent, and refreshingly brief, article over on Business Insider about the inexplicable amount of hype that tech media lavishes on startup funding crystallized what’s [...]

    Read more
  • The Building Windows 8 Blog is Amazin...

    Wow! The Building Windows 8 blog is amazing. And the most recent post, Reflecting on your comments on the Start screen, in which they respond to a number of the comments abou [...]

    Read more
  • My iPad Must Have App List

    I was recently asked for a list of apps I would recommend for the iPad. I decided to do it up right, with links and some brief commentary and post it on the blog. Seemed the [...]

    Read more

Posts in category Reporting

Formatting Map Legends in SQL Server 2008 R2 Reporting Services

Jan8th
2012
2 Comments Written by Will

Recently I needed to do some slightly more advanced formatting of a map legend in SQL Server 2008 R2 Reporting Services (SSRS). I love the map reports you can build with SSRS in 2008 R2 but if your legend needs to show anything other than whole numbers, like a percentage, or perhaps a decimal value, or maybe even display negative values using parentheses instead of dashes, well you might be thinking you’re out of luck.

Thankfully that’s not the case. There isn’t a convenient number format screen for the map legend but it is possible to do all of the fancy formatting you want; it just may not be apparent at first glance.

The first thing that might throw you is that formatting for the various values that you want in the legend is not done in the properties of the legend itself. Legends in SSRS maps are just containers. You can display the values for multiple pieces of data in a single legend, like showing both the color and the size of a bubble. This means that the number format for a particular data set is done on whichever layer contains that piece of data.

In the list of map layers click on the little down arrow to the right of the layer that contains the legend data you want to modify and then select either the color or the size rule that you want to display. In this example I’m changing the color rules for a point layer, but you’ll find the same options the center point of a polygon layer as well.

Layer Properties Select

Once in the properties dialog select the legend tab.

Layer Properties Dialog

Here you can select which legend container you want this legend to appear in and you can set the format in the “Legend text:” box.

Here’s a quick breakdown of the format string you see in that box:

#FROMVALUE{N0} - #TOVALUE{N0}
  • #FROMVALUE (and #TOVALUE) – pretty self explanatory these are indicators for the values on either side of each range in your legend.
  • {N0} – This is the format of the value on either side of range.
  • If you’re so inclined you can even change the center ‘-’ to some other character(s) to change how the range values are separated.

On to the formatting itself. “N0″ is the same formatting string you see elsewhere in your SSRS reports, meaning a number with 0 decimals. So by using rather typical Excel style formatting strings you can make the values in your legend look however you like. So

Showing 2 decimals

#FROMVALUE{N2} - #TOVALUE{N2}

Percent with a single decimal

#FROMVALUE{P1} - #TOVALUE{P1}

Or this way if you prefer

#FROMVALUE{#.0%} - #TOVALUE{#.0%}

Which means that if you want to get fancy and do something like, say, change negatives to use parentheses instead of a dash you can use a semicolon to delineate how a number looks when it’s positive or when it’s negative, like so: (I changed the separator to a || just for fun)

#FROMVALUE{#.0%;(#.0%)} || #TOVALUE{#.0%;(#.0%)}

I’ve been spending  a bit of time with map reports lately so I’ll some more mapping related stuff to post in the near future.

Maps, SQL 2008 R2, SSRS
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail

Recent Posts

  • Minnebar 2013 Wrap-Up
  • Thoughts on Killzone 3 Multiplayer Going Free-to-Play (or is it Free-to-Pay?)
  • A Game Funding Revolution
  • Named Set Sub-totals in Excel using VisualTotals()
  • New Camera Please. – Mirrorless ILC Goodness

Categories

  • BI
  • Gaming
  • Opinion
  • Photography
  • Reporting
  • Scripts
  • Social Games
  • SQL Server
  • XNA

Archives

  • April 2013
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • October 2011
  • September 2011
  • April 2011
  • January 2011
  • December 2009
  • July 2009
  • April 2009

EvoLve theme by Theme4Press  •  Powered by WordPress williamweber.net