Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

OLAP Advanced custom filters date

$
0
0

Hello,

How do i filter, in a MDX Query, just the FACTS that have ocurred in a Range of Months over last 3 years?

I need to make it dynamic so i can use parameters latter, so i need the following:

Month Range over last 3 years, Where StartMonth and EndMonth is given by user by parameters.

[2002].[January],  [2002].[February], [2002].[March]
[2003].[January],  [2003].[February], [2003].[March]
[2004].[January],  [2004].[February], [2004].[March]

Time dim have Year, Half Year, Quarter, Month, Week and Day level.

I have tryed this, but i get an error Mondrian Error:Cannot deduce type of set

WITH set [MesesFiltrados] as 
DESCENDANTS(
    FILTER(LastPeriods (3,
        StrToMember("[Data].[" || TRIM(Str(Int(YEAR(NOW())))) || "]")
    ),
      [Data].[Mes].currentmember in ([Data].Mes.[${StartMonth}]:[Data].Mes.[${StartMonth}])
  )
)

Select {[Escritorio]} on columns,
{
  MesesFiltrados  
}
on  rows 

From 
Desempenho

Tks



Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>