Wednesday, March 21, 2012

Formatting dates on a chart when sourced from SSAS2k5

I am creating a few charts in SSRS that are sourced from a cube in AS. On the x-axis is time, which is what I assume a date-like field in the cube. On the y-axis is the measure.

My problem is that I cannot seem to get the dates to format on the chart - regardless of the format code I use, the dates appear in long format, like "Thursday, November 23 2006".

Are the dates from SSAS just string values?

I feel that you may have mentioned some expression or modification done on that field.I faced this problem before where i came to know that Format expression which will be like (#000# Something...) when some operation is being performed on that date. Take out that any operation on that field and give only format option or use format function in the expression.

Hope it should work

Regards,

Raj Deep.A

|||Hi Raj,

I'm not sure I follow - I haven't modified the field at all, yet. I merely created an MDX Query using the designer, and Time is one of the dimensions I used to splice my measure by. I wanted to expose this data in a chart, but for some reason I can't apply any standard formatting codes to the Time label on the x-axis.|||

Based on your query in the MDX query generator, the date time value is provided as a string to Reporting Services. That's why format codes won't work.

You could look into either changing your MDX query to get the value as DateTime object (which means you have to hand-write the MDX) or you could try to convert the string back into a DateTime object in the chart category grouping expression by using an expression similar to this: =CDate(Fields!DateValue.Value)

But depending on the actual strings, the CDate() function may fail to convert and you may need to look into using a combination of several VB runtime conversion functions / DateTime functions to achieve the conversion.

-- Robert

|||That's what I feared...thanks for the confirmation. Hopefully something to look forward to in Katmai? [better integration between SSAS and SSRS, that is]|||

Another aproach is to assing a value to your attribute members and use the MemberValue MDX function.

1. In your cube, assign the Value property of the Date attribute hierarchy to a Date column in the underlying table.

2. Unfortunately, the RS SSAS data provider doesn't currently surface the MemberValue function so you need to create a calculated member, e.g. NativeDate with the following expression [Date].[Date].MemberValue.

3. Now you can format the calculated member as you wish, e.g. Format(Fields!NativeDate.Value, "MMM/dd/

|||How does this work with server time dimensions?|||Sorry, it won't b/c you won't be able to assign a value column to a server time dimension.

No comments:

Post a Comment