CRM Online Reporting FetchXML (Handy SQL Reporting)

by | Updated June 15, 2016 | Development, Dynamics CRM

CRM Online Reporting with FetchXML Series
Intro: Intro to Series
Part I: How to Set up a Data Source to Access CRM Data in SQL Reporting Services 
Part II: How to Use FetchXML Data in the Report
Part IIa: CRM FetchXML Operators
Part III: Handy SQL Reporting Services Functions for CRM Online Reports

When creating a report in SQL Server Reporting Services, there are a number of tweaks you can make to a report to make it look professional.  Here are a few of my more common changes I like to make to reports.

Create “Banded Rows” – a different background color for each report

This is a way to make your report much easier to read, so I like to do this with all of my SQL Reporting Services reports.  To do this, first you need to highlight the row in the design view:

Project Task

Then click down in the lower right in the Properties box:

SSRS Row Properties

Enter an expression in the Background Color drop arrow to change colors for every other row.  You can substitute in the color of choice for Lemon Chiffron here:

=IIf(RowNumber(Nothing) Mod 2,”LemonChiffon”,”White”)

Date Functions – DateAdd

I like to be able to default in start and end dates for parameters when I do time-based reporting, so I end up using the DateAdd function quite a bit to set the Start date parameter to 7 or 30 days before today.  The DateAdd works like this:

=DateAdd(DateInterval.[Span],[First Value],[Second Value])

So I use it like this:

=DateAdd(DateInterval.Day,-7,Today())

This gives me a start date of 7 days prior to today in the ShortDate format (with no time stamp).  To factor in the hour of the day, use the Now() function instead.

The [Span] values you can use for the DateInterval options are as follows: Year, Quarter, Month, Week, Day, Hour, Minute, Second.  You can sub in short values, such as “hh” for hour, but I figure it’s just easier to use the full name.

Formatting Values with 2 Decimals

In my report I was putting the value for the hours we spend on each task, and our smallest increment of time that we’d record is 15 minutes.  I like to represent the time in hours, so that means the max number of decimals in the report is 2.  I want consistency in the report, so I want all values to have two decimal places.  To make sure this works, you can put an expression around your value to make sure the value has two decimal places:

=FormatNumber(Fields!Data.Value,2)

I hope you find these functions helpful – it had been a year or so since I created a report, so it took a while for it all to come back to me.  Now I have a place to look the next time I get stuck.

Help with CRM 2

Related Posts

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Managing Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Management: Introduction of NEW Functionality for Manufacturers Using Dynamics 365

november

18nov10:00 am10:30 amThe Modern Manufacturer - Tears and Trauma of MRP

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X