Question

First things first, my cube's time dimension has been created by me from two separated dimension .

Time dimension with: hour, half hour , ten minutes and minutes fields .

Date dimension with: day, month and year fields

My problem is that, when I want to explore and filter several full days and not full days, results are like if I was only exploring full days.

Let me show you the mdx I use:

select non empty  ([Client].[Client].[Client],[Product].[Product].[Product]) on rows,
  {[Measures].[Example]}  on columns 
from [Cube] 
where ( {([Date].[Id].&[20131002] ) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2059]) } +{([Date].[Id].&[20130930] : [Date].[Id].&[20131001]) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2359]) }  )

That mdx works because there aren´t date or time dimension.

This one doesn't work:

select non empty  ([Date].[Date Field].[Date Field]) on rows,
  {[Measures].[Example]}  on columns 
from [Cube] 
where ( {([Date].[Id].&[20131002] ) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2059]) } + {([Date].[Id].&[20130930] : [Date].[Id].&[20131001]) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2359]) }  )

I have noticed that if I divide the mdx like this:

select non empty  ([Date].[Date Field].[Date Field]) on rows,
  {[Measures].[Example]}  on columns 
from [Cube] 
where ( {([Date].[Id].&[20131002] ) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2059]) }  }  

select non empty  ([Date].[Date Field].[Date Field]) on rows,
  {[Measures].[Example]}  on columns 
from [Cube] 
where ( {{([Date].[Id].&[20130930] : [Date].[Id].&[20131001]) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2359]) }  

it works! But I want do it , with one mdx.

If anyone could help me I would be very grateful!!

Regards.

Was it helpful?

Solution

You could try with a subselect:

select non empty  (EXISTING [Date].[Date Field].[Date Field]) on rows,
  {[Measures].[Example]}  on columns 
from (select 
     ( {([Date].[Id].&[20131002] ) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2059]) } 
     + {([Date].[Id].&[20130930] : [Date].[Id].&[20131001]) *([Time].[Time Field].&[0] : [Time].[Time Field].&[2359]) }  )
      on columns
      from [Cube]
     )

By the way, your MDX is illegal (but Analysis Services is tolerant): According to the MDX specification, columns must be specified before rows in the select clause.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top