Вопрос

I have an annual report where I want the months to be displayed in columns Jan-Dec, even for the months that don't have any values.

Today I have a matrix report that starts on May as that month is the month with the first values. But I want the tables to start on January, even if there are no values for that month.

I also wonder if I can have several rows in the same matrix but with different data sources (XMLFetches).

I'll explain a bit more. Really ought to be a fairly simple raport where I want to show how much is sold on a monthly basis and each month is a column and the rows are the products.
i'm using a fetchXML from CRM 2011 on-line.

Month jan feb mar apr may jun jul

Wheels 0 0 0 0 10 65 75

Cars 0 10 0 10 0 100 175

Это было полезно?

Решение

It's not possible to combine different datasets in the same matrix on the report, however, you can combine datasources to create one dataset before presenting the dataset to a report. For example you could use a stored procedure (or SSIS or powershell etc) to read from the database and combine the data into a table, temp table, table variable in the database and then query that from the report - or in the Fetch XML

To get a report that shows calendar entries even for entries that have no data you need to start with the calendar you require and then left-join it to your actual data.

If you are doing this from dynamics CRM and are familiar with editing the FetchXML yourself then you can join data from multiple entities using the with the as appropriate. This other article on stack overflow details that technique: Left join in FetchXml?

For example, if your report has just the months, you could create a calendar table with 3 columns, Year, Month and MonthNumber. The MonthNumber is important for sorting months in the report because you can't order months alphabetically. If you only ever show a single calendar year on the report then the year column might not be necessary but this is something you can reuse for many reports so it's worth doing properly. If you want to read more about them, look up "calendar table", there are many opinions on how to create them, but maybe start with a simple one to get comfortable with the idea. If you left join the calendar table to your month data, you will get NULL values for the months January to April (because your data starts in May) and you may want to replace these NULL values with 0 or an empty string, depending on what is appropriate. Using isnull() or nvl() or whatever the appropriate function is in your database could be appropriate there.

Другие советы

The answer to how I built the sorting on month is that I used parameters to build up the month-year value for a specific column that I then use to compare with the month-year-value from the fetch.

In the column =Sum(Cint(IIF(Fields!startmonth.value=Cint(Parameters!year.Value & Parameters!jan.Value),Fields!money.Value,0)))

So the month-year-value from the fetch is via a calculated field built up to e.g. 201302 and that is then compared to the selected year 2013 and added the monthvalue for that specific column 02=201302.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top