CRM Online Reporting FetchXML (Handy SQL Reporting)

By Eric Newell | December 10, 2012

Crm online reporting fetchxml (handy sql reporting)

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.,,)

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 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

Recommended Reading:

Manage U.S. Use Tax on Purchase Orders in Dynamics 365 Finance and Operations

  Managing sales tax requirements on your business purchase can be complicated, but Dynamics 365 Finance and Operations can help […]

Read the Article
5.19.22 Dynamics CRM

How to Write a Great Support Ticket in the Stoneridge Support Portal

Submitting a support ticket through the Stoneridge Support Portal is a quick and effective way to get assistance for any […]

Read the Article

Managing Your Business Through Uncertain Times Using Dynamics 365 Finance and Operations

  Dynamics 365 Finance and Operations (F&O) can help you make informed decisions on how to move your business forward. […]

Read the Article
5.13.22 Power Platform

Using Power BI Object Level Security

  The following article will demonstrate how to use Power BI Object Level Security to disable column data based on […]

Read the Article
5.12.22 Dynamics CRM

How to Use the Stoneridge Support Portal

Stoneridge Software’s support portal is an intuitive and useful function that makes it easy for you to access resources to […]

Read the Article
5.6.22 Dynamics GP

Dynamics GP Transaction Removal: Purchase Orders

  Are you having performance issues with Purchase Orders?  Do you find that there are old Purchase Orders on your […]

Read the Article
5.5.22 Dynamics GP

The Real Story about the Long-Term Future of Dynamics GP Support

I’ve seen a number of people put forward comment that Dynamics GP is going away and you have to get […]

Read the Article

New Features in Dynamics 365 Business Central 2022 Wave 1 Release – Financial Enhancements

The Dynamics 365 Businses Central 2022 Wave 1 Release has a lot of new and exciting features to help your […]

Read the Article
4.29.22 Dynamics GP

Dynamics GP Transaction Removals: Bank Reconciliation

  This is part 2 of a 3 part series on Dynamics GP Transaction Removals. These quick tips will hopefully […]

Read the Article

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X