![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
| With Set [SelectedMonths] as |
#3
| |||
| |||
|
|
Assuming that the selected time periods are defined in the [SelectedMonths] Named Set, this Foodmart Sales query defines [Regular] and [Irregular] Customer calculated members, based on fact records existing in all periods: With Set [SelectedMonths] as '{[Time].[1997].[Q1].[1], [Time].[1997].[Q2].[5], [Time].[1997].[Q3].[9]}' Member [Customers].[All Customers].[Regular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) = Count([SelectedMonths])))' Member [Customers].[All Customers].[Irregular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) Count([SelectedMonths])))' Select [Measures].Members on columns, {[Customers].[All Customers].[Regular], [Customers].[All Customers].[Irregular]} on rows from Sales - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
|
Hello again: I'm afraid that I did not express myself clearly. The problem is that I cannot assume the selected time periods are known nor construct the query, because my client works with ProClarity. ProClarity permits the user to select members in each dimension and to specify the dimension location (row, column or slice). Once this information is obtained, the ProClarity builds the MDX query that is sent to the OLAP server. The server response is read by ProClarity and presented to the user as a data matrix or diagram. It means that I cannot change MDX query built by the ProClarity Software. The only thing I can do is to provide calculated members and hide measures. The idea I had was to hide cube measures (for example units) and to define calculated members (for example units2). This measure should behave in the following way: iif([RegularClients].CurrentMember.Name<>'Regular', [Measures].[Units], ([Measure].[Units],[Store].CurrentMember,...,[Customer].[RegularCalculatedMember])) where [Customer].[RegularCalculatedMember] ought to contain definition similar to the expression given by Deepak: 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) = Count([SelectedMonths])))' BUT THE PROBLEM IS: how to obtain the set: [SelectedMonths]. This set (or rather its equivalent) is hidden among the MDX query generated by the ProClarity, but I do not know how I can access it from the calculated member definition. Obviously, if I could replace ProClarity with the application I wrote, the solution given by Deepak would fit ideally. I hope that this explanation is clear enough. Regards, Maciej Kiewra Assuming that the selected time periods are defined in the [SelectedMonths] Named Set, this Foodmart Sales query defines [Regular] and [Irregular] Customer calculated members, based on fact records existing in all periods: With Set [SelectedMonths] as '{[Time].[1997].[Q1].[1], [Time].[1997].[Q2].[5], [Time].[1997].[Q3].[9]}' Member [Customers].[All Customers].[Regular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) = Count([SelectedMonths])))' Member [Customers].[All Customers].[Irregular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) Count([SelectedMonths])))' Select [Measures].Members on columns, {[Customers].[All Customers].[Regular], [Customers].[All Customers].[Irregular]} on rows from Sales - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#5
| |||
| |||
|
| With |
#6
| |||
| |||
|
|
Maciej, There are a few ways to access the MDX that ProClarity creates that might make this easier for you. The first is the ProClarity MDX editor, while it is probably not appropriate for your current problem, it does allow a user to imput MDX directly for a query. It is accessed form the [View] menu item in the Profesional Clients. The second is from the KCommand object that is easily accessed using an addin with VBA. The KCommand has a property named finalMDX that will give you access to the MDX that will be passed to the OLAP provider. You can check exactly what query is being run by ProClarity Desktop Professional client by searching for the query.log file. I would strongly recommend calling ProClarity technical support or visiting the ProClarity Best Practices Community where there is sample code and forum discussing how to do exactly these sort of modifications. Also, ProClarity does sell a product called KPI Designer that may be able to generate the query you are referring to without any coding at all. Good Luck! mkiewra (AT) mail (DOT) fujitsu.es wrote: Hello again: I'm afraid that I did not express myself clearly. The problem is that I cannot assume the selected time periods are known nor construct the query, because my client works with ProClarity. ProClarity permits the user to select members in each dimension and to specify the dimension location (row, column or slice). Once this information is obtained, the ProClarity builds the MDX query that is sent to the OLAP server. The server response is read by ProClarity and presented to the user as a data matrix or diagram. It means that I cannot change MDX query built by the ProClarity Software. The only thing I can do is to provide calculated members and hide measures. The idea I had was to hide cube measures (for example units) and to define calculated members (for example units2). This measure should behave in the following way: iif([RegularClients].CurrentMember.Name<>'Regular', [Measures].[Units], ([Measure].[Units],[Store].CurrentMember,...,[Customer].[RegularCalculatedMember])) where [Customer].[RegularCalculatedMember] ought to contain definition similar to the expression given by Deepak: 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) = Count([SelectedMonths])))' BUT THE PROBLEM IS: how to obtain the set: [SelectedMonths]. This set (or rather its equivalent) is hidden among the MDX query generated by the ProClarity, but I do not know how I can access it from the calculated member definition. Obviously, if I could replace ProClarity with the application I wrote, the solution given by Deepak would fit ideally. I hope that this explanation is clear enough. Regards, Maciej Kiewra Assuming that the selected time periods are defined in the [SelectedMonths] Named Set, this Foodmart Sales query defines [Regular] and [Irregular] Customer calculated members, based on fact records existing in all periods: With Set [SelectedMonths] as '{[Time].[1997].[Q1].[1], [Time].[1997].[Q2].[5], [Time].[1997].[Q3].[9]}' Member [Customers].[All Customers].[Regular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) = Count([SelectedMonths])))' Member [Customers].[All Customers].[Irregular] as 'Aggregate(Filter([Customers].[Name].Members, Count(NonEmptyCrossJoin([SelectedMonths], {[Customers].CurrentMember}, {[Measures].[Unit Sales]}, 1)) Count([SelectedMonths])))' Select [Measures].Members on columns, {[Customers].[All Customers].[Regular], [Customers].[All Customers].[Irregular]} on rows from Sales - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |