简体   繁体   中英

How do I show a timestamp member as a date in SQL Server MDX queries

I have a scenario where I the dimension has a series of date / time members but instead I want to show it grouped to the day, how do I do that?

Example cube query:

select {[Measures].[Count]} on columns, 
       [Date].[Date].[Date] on rows
from [Cube]

and this query returns:

                        | count
2014-03-03 15:50:24.000 |   1
2014-03-03 16:05:10.000 |   1
2014-03-03 16:05:21.000 |   1
2014-03-02 16:30:13.000 |   1

I want to be able to show

           | count
2014-03-03 |  3
2014-03-02 |  1

I'm using Microsoft Analysis Services 2008 R2 and the MDX queries for that

Maybe this is a little similar to what you're trying to achieve:

WITH 
  MEMBER [Measures].[countDays] AS 
    Count((EXISTING [Date].[Calendar].[Date])) 
SELECT 
  {[Measures].[countDays]} ON COLUMNS
 ,[Date].[Calendar].[Month] ON ROWS
FROM [Adventure Works];

It returns the following:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM