![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
What errors are you experiencing - can you give an example? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| ||||
| ||||
|
| % of Total Charge Amt = |
| PASS December 2002 |
#5
| |||
| |||
|
|
Hi Feranando, You can try something like: % of Total Charge Amt = [Measures].[Charge Amt])/ ([Measures].[Charge Amt], StrToSet("Axis(1)").Item(0).Item(0).Dimension.Defa ultMember) There are earlier discussion threads in this newsgroup discussing similar requirements. The section on "Flexible Percent" below may also give you some ideas: http://www.tomchester.net/articlesdo...desamples.html PASS December 2002 Pushing the MDX Envelope Code Samples ... Flexible Percent of Total Works with any set and any measure (assumes measure being operated upon is in first column) ... - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Hi Fernando, Can you give an example of how you want the percent computed with multiple dimensions on rows - should it be based on the grand total for all row dimensions in denominator, or just based on 1 row dimension? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#8
| |||
| |||
|
|
Hi Fernando, Can you give an example of how you want the percent computed with multiple dimensions on rows - should it be based on the grand total for all row dimensions in denominator, or just based on 1 row dimension? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#9
| |||
| |||
|
| WITH |
#10
| |||
| |||
|
|
Hi Fernando, Starting from your example, I created a calculated measure and cell for Foodmart Sales, which seem to work for 1 level of drill-down. I based the calculated cell on this post in Chris Webb's blog: http://spaces.msn.com/members/cwebbbi/Blog/cns!1pi7ETChsJ1un_2s41jm9Iyg! 130.entry The Foodmart query below defines a calculated measure: [RollupFraction] and cell: [LowestDim]. But I was also able to add these to the Sales cube and create an equivalent Excel pivot table: WITH MEMBER [MEASURES].[RollupFraction] AS '2' CELL CALCULATION [LowestDim] FOR '({[MEASURES].[RollupFraction]})' AS 'IIF(IsEmpty(StrToSet("Axis(0)").Item(0).Item(StrT oSet("Axis(0)").Item(0 ).Count-1)), NULL, iif(CALCULATIONPASSVALUE([MEASURES].[RollupFraction], -1, RELATIVE) < 2, CALCULATIONPASSVALUE([MEASURES].[RollupFraction], -1, RELATIVE), iif(CALCULATIONCURRENTPASS() = 129, 1, iif(Intersect(Extract(StrToSet("Axis(1)"), StrToSet("Axis(1)").Item(0).Item(128-CALCULATIONCURRENTPASS()).Dimension ), {StrToSet("Axis(1)").Item(0).Item(128-CALCULATIONCURRENTPASS()).Dimensio n.Parent}).Count= 0, 2, StrToSet("Axis(0)").Item(0).Item(StrToSet("Axis(0) ").Item(0).Count-1)/ (StrToSet("Axis(0)").Item(0).Item(StrToSet("Axis(0 )").Item(0).Count-1), StrToSet("Axis(1)").Item(0).Item(128-CALCULATIONCURRENTPASS()).Dimension .Parent)))))', CALCULATION_PASS_NUMBER=129, CALCULATION_PASS_DEPTH=128, SOLVE_ORDER=2, FORMAT_STRING = 'Percent', CONDITION='CALCULATIONCURRENTPASS()>(128-StrToSet("Axis(1)").Item(0).COU NT)' SELECT {[Measures].[Unit Sales], [MEASURES].[RollupFraction]} ON columns, Non Empty CrossJoin([Store Type].Members, CrossJoin([Education Level].Members, [Yearly Income].Members)) on rows FROM SALES - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
![]() |
| Thread Tools | |
| Display Modes | |
| |