Frage

I have a Mondrian/MDX query where I grab data within a date range, but I'd like to return time as the value of its property in the result. My current query is like:

With
set [*TIME_RANGE] as '{[Time].[2011].[3].[9].[1].[1].Lag(30):[Time].[2011].[3].[9].[1].[1]}'
set [*PXMD] as '[meta_pixel_id1.Pixel].[label].Members'
set [*BASE_MEMBERS] as 'NonEmptyCrossJoin([*TIME_RANGE],[*PXMD])'
Select
{[Measures].[total_users],[Measures].[total_action_pixels]} on columns,
[*BASE_MEMBERS] on rows
From [ActionPixels]
Where [Pixel ID].[500]

Which returns a result like:

Axis #0:
{[Pixel ID].[500]}
Axis #1:
{[Measures].[total_users]}
{[Measures].[total_action_pixels]}
Axis #2:
{[Time].[2011].[3].[8].[4].[24], [meta_pixel_id1.Pixel].[500].[Action].[Type].[Handraiser]}
{[Time].[2011].[3].[8].[4].[24], [meta_pixel_id1.Pixel].[500].[Action].[Type].[Lead]}
{[Time].[2011].[3].[8].[4].[24], [meta_pixel_id1.Pixel].[500].[Action].[Type].[Shopper]}
Row #0: 3
Row #0: 3
Row #1: 4
Row #1: 4
Row #2: 2
Row #2: 2

Which is what I expect. Problem is, I'm writing this query for use in a Pentaho xaction, so I have some Javascript code afterwards that converts this into a JSON format and when I got to extract the value of the [Time] column, I get back only the day number (in this case, 24). What I want to display instead is the property of the [Time].[Day] dimension we call Date String that contains the date formatted as year-month-day. But none of the examples I can find of how to do this will work with my selection on [Time] by range.

The most immediate solution seems to be to display the Date String property, but I'd be willing to entertain other ideas that will let me get both the data I want and filter on the time range I want.

War es hilfreich?

Lösung

I was able to solve the problem based on the code found online. I had tried something like that before, but it wasn't working because of what was ultimately a problem with the property in the cube that caused it to always return null rather than the value in the table the time dimension was created from.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top