powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / SQL -> MDX
3 сообщений из 3, страница 1 из 1
SQL -> MDX
    #32688054
vc123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Hello,

If I want to express the same as the SQL below in MDX:

Код: plaintext
1.
2.
3.
4.
SELECT STATE,SUM(STORE_SALES)
FROM table
WHERE product='Good Imported Beer' OR year= 1998 
GROUP BY STATE

... in MDX, would this be a reasonable translation:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
WITH
MEMBER Product.mySum AS
'Aggregate (
  Unique ( {
    NonEmptyCrossJoin (
      { Product.[Good Imported Beer] },
      { Time.Year .members}
    )
    +   
    NonEmptyCrossJoin (
      { Product.[Product Name].members },
      { Time.[1998] }
    )
  }), Measures.[Store Sales]
 )'
SELECT
  { Product.mySum } on  0 ,
  Customers.USA.children on  1 
FROM Sales

... or there exists a more elegant expression (in MDX) ?


Also, why this MDX produces an error:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
WITH
MEMBER Measures.mySum AS
'Aggregate (
  Unique ( {
    NonEmptyCrossJoin (
      { Product.[Good Imported Beer] },
      { Time.Year .members}
    )
    +   
    NonEmptyCrossJoin (
      { Product.[Product Name].members },
      { Time.[1998] }
    )
  }), Measures.[Store Sales]
 )'
SELECT
  { Measures.mySum } on  0 ,
  Customers.USA.children on  1 
FROM Sales


Thanks.
...
Рейтинг: 0 / 0
SQL -> MDX
    #32688568
Владимир Штепа
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
IMHO вместо "+" надо ","
...
Рейтинг: 0 / 0
SQL -> MDX
    #32688576
vc123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
<quote>
IMHO вместо "+" надо ","
</quote>

1. '+' and ',' do the same in this context, namely produce a union of two sets.
The real problem is that Measures.mySum does not work while Product.mySum (see the first version) does. You can easily veri

2. Do you have any thoughts on simplifying the sql->mdx translation ? Is it a general approach with MDX that when you want to describe sets defined by more or less arbitrary predicates, you need to use some combination of CrossJoin and Union ? In SQL, you'd just use predicates in the where clause plus joins when necessary.

Thanks.
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / SQL -> MDX
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]