![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
OK let me pose this question: Say one had a cube with a date dimension. How would one go about determining the min and max values in it? we have a internally developed OLAP application serving reports that we want to display the date range for available data. This is obviously very simple with relational data, but not easy in OLAP... can one interrrogate the dimension via XMLA, or is there an MDX statement one could run? -Eric |
#3
| |||
| |||
|
|
Hi Eric - As long as your cube isn't too large, you can derive these values from the cube data. You can use filtered sets and members based upon their first and last members to give you what you're asking for. Something like: with set [MonthsWithData] as 'Filter({[time].[month].members }, [Measures].[Unit Sales] <> NULL)' set [FirstMonthWithData] as 'Head([MonthsWithData],1)' set [LastMonthWithData] as 'Tail([MonthsWithData],1)' member [measures].[FirstMonthWithData] as 'TupleToStr([FirstMonthWithData].item(0))' member [measures].[LastMonthWithData] as 'TupleToStr([LastMonthWithdata].item(0))' select {[measures].[FirstMonthWithData], [measures].[LastMonthWithData]} on columns from sales The above code is for foodmart, which only goes down to month, it's just an example. You would substitute the day level where appropriate. Also, it will return a fully qualified hierarchical name, so you may want to do some string parsing in those resulting calculated members. If your cube is really large, this could potentially be slow, especially if it's not partitioned by time. With a really large cube, you'd be better of having member properties of the time dimension (at the day level) that denote which are the first and last days with data. Your usual SQL processing could update these columns accordingly when new fact data is processed. You could then filter for these member properties. Good luck. - Phil "Eric S" wrote: OK let me pose this question: Say one had a cube with a date dimension. How would one go about determining the min and max values in it? we have a internally developed OLAP application serving reports that we |
![]() |
| Thread Tools | |
| Display Modes | |
| |