![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
| Sum(NonEmptyCrossJoin(Descendants( |
#3
| |||
| |||
|
|
"the Filter set in current year" Meant that All Level of Time dimension has been disabled and includedmembers |
|
It's not clear what "the Filter set in current year" is. Assuming that the query is filtering out empty members (in this case, Q4 2004), and that the lowest [Time] level at which data is loaded is [Month]), then will this work? Sum(NonEmptyCrossJoin(Descendants( [Time].CurrentMember, [Time].[Month])), ([MEASURES].[Sales], ParalellPeriod([TIME].[YEAR]))) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Assuming that your client tool is Excel Pivot Table, I logged the MDX queries for a similar scenario in the Foodmart Warehouse cube (contains 1997 and 1998 data). Based on the MDX queries, it looks like Excel is requesting complete year (1998) data, even when only Q1-Q3 are selected on rows. So Excel must be doing 1998 summation separately for [Warehouse Sales], so that only Q1-Q3 are included. However, as you found, the entire Previous Year results are used, as returned from MDX - I can't explain why. Here is how I did the filtered sum for Previous Year - this only works when Time is on rows of Pivot Table, and for single level of DrillDown (Year->Quarter). It could be enhanced to work on columns and for multiple levels: - [Measures].[SalesYTD] : Sum(YTD(), [Measures].[Warehouse Sales]) - [Measures].[SalesPrev] : iif(Count(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time]))) = 0, ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])), Sum(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time])), ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])))) - [Measures].[SalesPrevYTD] : Sum(YTD(), [Measures].[SalesPrev]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#6
| |||
| |||
|
|
Hi, this is an excellent approach, working in AS-Manager and Excel even on all dimension levels of time, but unfortunately our main Frontend are the OWC, with which this formula doesn't work ( i believe it's the StrToSet("Axis(1)") Part) I once again figured out, that MDX isn't quite my domain :-| How can i make a Set out of Time-Dimension IncludedMembers (especially with Web components) not depending if the dimension is located in filter, rows or columns? I just cant get this one to work... Greetings and thx again Monte "Deepak Puri" wrote: Assuming that your client tool is Excel Pivot Table, I logged the MDX queries for a similar scenario in the Foodmart Warehouse cube (contains 1997 and 1998 data). Based on the MDX queries, it looks like Excel is requesting complete year (1998) data, even when only Q1-Q3 are selected on rows. So Excel must be doing 1998 summation separately for [Warehouse Sales], so that only Q1-Q3 are included. However, as you found, the entire Previous Year results are used, as returned from MDX - I can't explain why. Here is how I did the filtered sum for Previous Year - this only works when Time is on rows of Pivot Table, and for single level of DrillDown (Year->Quarter). It could be enhanced to work on columns and for multiple levels: - [Measures].[SalesYTD] : Sum(YTD(), [Measures].[Warehouse Sales]) - [Measures].[SalesPrev] : iif(Count(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time]))) = 0, ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])), Sum(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time])), ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])))) - [Measures].[SalesPrevYTD] : Sum(YTD(), [Measures].[SalesPrev]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#7
| |||
| |||
|
|
Now I have no time to test this idea, but hope the help. Remember that you have to flush cached data for each test. [S_PREV] = IIF(SetToStr(Intersect(Time.CurrentMember.Children , StrToSet("AXIS(1)"))) = "{}", (ParallelPeriod(Year, 1), [SALES]), Sum(Intersect(Time.CurrentMember.Children, StrToSet("AXIS(1)")), [S_PREV])) Ohjoo Kwon "Monte" <Monte (AT) discussions (DOT) microsoft.com> wrote in message news:B793E7FC-D603-4006-B78A-92201581076E (AT) microsoft (DOT) com... Hi, this is an excellent approach, working in AS-Manager and Excel even on all dimension levels of time, but unfortunately our main Frontend are the OWC, with which this formula doesn't work ( i believe it's the StrToSet("Axis(1)") Part) I once again figured out, that MDX isn't quite my domain :-| How can i make a Set out of Time-Dimension IncludedMembers (especially with Web components) not depending if the dimension is located in filter, rows or columns? I just cant get this one to work... Greetings and thx again Monte "Deepak Puri" wrote: Assuming that your client tool is Excel Pivot Table, I logged the MDX queries for a similar scenario in the Foodmart Warehouse cube (contains 1997 and 1998 data). Based on the MDX queries, it looks like Excel is requesting complete year (1998) data, even when only Q1-Q3 are selected on rows. So Excel must be doing 1998 summation separately for [Warehouse Sales], so that only Q1-Q3 are included. However, as you found, the entire Previous Year results are used, as returned from MDX - I can't explain why. Here is how I did the filtered sum for Previous Year - this only works when Time is on rows of Pivot Table, and for single level of DrillDown (Year->Quarter). It could be enhanced to work on columns and for multiple levels: - [Measures].[SalesYTD] : Sum(YTD(), [Measures].[Warehouse Sales]) - [Measures].[SalesPrev] : iif(Count(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time]))) = 0, ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])), Sum(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time])), ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])))) - [Measures].[SalesPrevYTD] : Sum(YTD(), [Measures].[SalesPrev]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#8
| |||
| |||
|
|
Hi, this is an excellent approach, working in AS-Manager and Excel even on all dimension levels of time, but unfortunately our main Frontend are the OWC, with which this formula doesn't work ( i believe it's the StrToSet("Axis(1)") Part) I once again figured out, that MDX isn't quite my domain :-| How can i make a Set out of Time-Dimension IncludedMembers (especially with Web components) not depending if the dimension is located in filter, rows or columns? I just cant get this one to work... Greetings and thx again Monte "Deepak Puri" wrote: Assuming that your client tool is Excel Pivot Table, I logged the MDX queries for a similar scenario in the Foodmart Warehouse cube (contains 1997 and 1998 data). Based on the MDX queries, it looks like Excel is requesting complete year (1998) data, even when only Q1-Q3 are selected on rows. So Excel must be doing 1998 summation separately for [Warehouse Sales], so that only Q1-Q3 are included. However, as you found, the entire Previous Year results are used, as returned from MDX - I can't explain why. Here is how I did the filtered sum for Previous Year - this only works when Time is on rows of Pivot Table, and for single level of DrillDown (Year->Quarter). It could be enhanced to work on columns and for multiple levels: - [Measures].[SalesYTD] : Sum(YTD(), [Measures].[Warehouse Sales]) - [Measures].[SalesPrev] : iif(Count(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time]))) = 0, ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])), Sum(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time])), ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])))) - [Measures].[SalesPrevYTD] : Sum(YTD(), [Measures].[SalesPrev]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#9
| |||
| |||
|
|
Well... It looks like that OWC and Excel recognize the Axis sequence differently. How about changing StrToSet("Axis(1)") to StrToSet("Axis(0)") ? Ohjoo Kwon "Monte" <Monte (AT) discussions (DOT) microsoft.com> wrote in message news:B793E7FC-D603-4006-B78A-92201581076E (AT) microsoft (DOT) com... Hi, this is an excellent approach, working in AS-Manager and Excel even on all dimension levels of time, but unfortunately our main Frontend are the OWC, with which this formula doesn't work ( i believe it's the StrToSet("Axis(1)") Part) I once again figured out, that MDX isn't quite my domain :-| How can i make a Set out of Time-Dimension IncludedMembers (especially with Web components) not depending if the dimension is located in filter, rows or columns? I just cant get this one to work... Greetings and thx again Monte "Deepak Puri" wrote: Assuming that your client tool is Excel Pivot Table, I logged the MDX queries for a similar scenario in the Foodmart Warehouse cube (contains 1997 and 1998 data). Based on the MDX queries, it looks like Excel is requesting complete year (1998) data, even when only Q1-Q3 are selected on rows. So Excel must be doing 1998 summation separately for [Warehouse Sales], so that only Q1-Q3 are included. However, as you found, the entire Previous Year results are used, as returned from MDX - I can't explain why. Here is how I did the filtered sum for Previous Year - this only works when Time is on rows of Pivot Table, and for single level of DrillDown (Year->Quarter). It could be enhanced to work on columns and for multiple levels: - [Measures].[SalesYTD] : Sum(YTD(), [Measures].[Warehouse Sales]) - [Measures].[SalesPrev] : iif(Count(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time]))) = 0, ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])), Sum(Intersect([Time].Children, Extract(StrToSet("Axis(1)"), [Time])), ([Measures].[Warehouse Sales], ParallelPeriod([Time].[Year])))) - [Measures].[SalesPrevYTD] : Sum(YTD(), [Measures].[SalesPrev]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |