简体   繁体   English

使用Visual Studio中的MDX查询生成器,如何过滤参数以选择“ 1/1/2010”-上个月?

[英]Using the MDX query builder in Visual Studio, how can I filter the parameters to choose '1/1/2010' - last month?

I have been trying to pass dynamic date parameters in SSRS's Visual Studio using SSAS and the Query Designer. 我一直在尝试使用SSAS和查询设计器在SSRS的Visual Studio中传递动态日期参数。 I am trying to get my MDX query to pull from '1/1/2010' to last month using the CalendarMonth field. 我正在尝试使用CalendarMonth字段将MDX查询从“ 1/1/2010”拉到上个月。 Here is my query: 这是我的查询:

SELECT 
  NON EMPTY 
    {
      [Measures].[Full Case Quantity]
     ,[Measures].[Total]
     ,[Measures].[Verified Total]
    } ON COLUMNS
 ,NON EMPTY 
    {
        [PA Product].[PA Description].[PA Description].ALLMEMBERS*
        [PA Product].[PA Product ID].[PA Product ID].ALLMEMBERS*
        [Time].[Calendar Month].[Calendar Month].ALLMEMBERS*
        [PA Product].[PA Uom].[PA Uom].ALLMEMBERS*
        [Distributor].[Dist Name].[Dist Name].ALLMEMBERS*
        [Time].[Calendar Year].[Calendar Year].ALLMEMBERS*
        [Time].[Month Number Of Year].[Month Number Of Year].ALLMEMBERS
    }
  DIMENSION PROPERTIES 
    MEMBER_CAPTION
   ,MEMBER_UNIQUE_NAME
   ON ROWS
FROM 
(
  SELECT 
    {[Concept OG].[Is Concept Display].&[1]} ON COLUMNS
  FROM 
  (
    SELECT 
      {[Concept].[Concept ID].&[6501]} ON COLUMNS
    FROM 
    (
      SELECT 
        NULL : StrToMember(@ToTimeCalendarMonth,CONSTRAINED) ON COLUMNS
      FROM [Management]
    )
  )
)
WHERE 
  (
    [Concept].[Concept ID].&[6501]
   ,[Concept OG].[Is Concept Display].&[1]
  )
CELL PROPERTIES 
  VALUE
 ,BACK_COLOR
 ,FORE_COLOR
 ,FORMATTED_VALUE
 ,FORMAT_STRING
 ,FONT_NAME
 ,FONT_SIZE
 ,FONT_FLAGS;

Not sure what the problem is so need to do some digging! 不确定是什么问题,因此需要进行一些挖掘!

If you run the following in SSMS what is returned? 如果在SSMS运行以下命令,将返回什么? You will need to replace @ToTimeCalendarMonth with whatever your parameter is passing in: 您将需要用@ToTimeCalendarMonth的任何参数替换@ToTimeCalendarMonth

SELECT 
    {} on 0,
    NULL : StrToMember(@ToTimeCalendarMonth,CONSTRAINED) ON 1
FROM [Management]

The parameter will need to be something like this ... I don't know how the members in your cube look so this is a guess: 该参数将需要是这样的...我不知道多维数据集中的成员的外观,所以这是一个猜测:

[Time].[Calendar Month].[Calendar Month].[200604]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pandas - 使用查询过滤最近 n 个月的数据 - Pandas - filter data that are in last n month using query 如何选择时间now()在Visual Studio 2010中使用SQL查询 - How to select time now() use sql query in visual studio 2010 如何选择特定月份的最近一个月的月份的最后一天? - How can I select the last day of the month for the nearest past month for a specific month? 如何使用DateTime获取当月的最后一天? - How can I get the last day of the current month with DateTime? 如何在 Pandas 中 select '本月的最后一个工作日'? - How can I select 'last business day of the month' in Pandas? 如何使用 PostgreSQL 确定上个月的最后一天? - How do I determine the last day of the previous month using PostgreSQL? 如果给定的日期是本月的最后一天,如何增加月份数? - How can I increment month number if given day is last day of current month? 如何在当前年份,django中查询当前年份的对象 - How can i query for objects in current year , current month in django 如何获得一个月的最后一天? - How do I get the last day of a month? 如何编写 where 子句以动态获取上个月某个日期和当前月份某个日期之间的日期? - How can I write a where clause to get dates between some date in the last month and some date in the current month, dynamically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM