Showing posts with label calculated. Show all posts
Showing posts with label calculated. Show all posts

Friday, March 30, 2012

Problem with calculated member (AS2005)

Hi all,
I'm having some strange problems with a calculated member in AS2005.
My calculated_member definition is as follows:

([Measures].[measure_1]/[Measures].[measure_2])

Now, i have an mdx query that uses that member. Something like:

SELECT [Measures].[measure_1],[Measures].[measure_2],[Measures].[calculated_member] ON COLUMNS
blah blah on ROWS
FROM [mycube]
WHERE some date conditions

[Measures].[measure_1] value is 2285.4 (this number is correct, i verified it)
[Measures].[measure_2] value is 82.67 (this number is correct, i verified it)
[Measures].[calculated_member] value is 14805.03 (WRONG, should be 2285.4/82.67= 27.64!!!)

What's going on here? I don't get why calculated_member fails, when the measures it depends on are just fine. Could someone give me a hint.

PS: measure_1 and measure_2 are both calculated as well.
PS2: all measures have "MEASURES" as parent hierarchy.

Hi,

I think the problem is the SOLVE_ORDER. For example

your measure_1 Sum is added from a1 + a2 + a3 + a4 + ....
your measure_2 Sum is added from b1 + b2 + b3 + b4 + .....

Your "wrong" calculated member sum comes from a1/b1 + a2/b2 + a3/b3 + a4/b4 + .....

but you would like to build a sum like (a1 + a2 + a3 + a4 + ....) / (b1 + b2 + b3 + b4 + .....)

This you could handle with the SOLVE_ORDER directive

MEMBER [Measures].[calculated_member] As ([Measures].[measure_1]/[Measures].[measure_2]) SOLVE_ORDER=1 .....

Hans

|||Thanks for the advice. Unfortunately in calculations tab of sql2005, the script expression doesn't allow SOLVE_ORDER clause (my calculated member was not defined in the MDX query, but IN THE CUBE). By manually changing this particular calculation to the bottom of the list (in the "script organizer" pane to the left of the screen) the problem was gone, so I guess it has to do with the order in which you define calculated members in a cube, isn't it?|||Order matters, but you can always manually overwrite SOLVE_ORDER if you need to. Just switch to the Script View from the Forms View and add ", SOLVE_ORDER=..." at the end of CREATE MEMBER statement.

Wednesday, March 28, 2012

Problem with BIDS

I'm designing an olap db with BIDS (business intelligence developer studio) but I cannot add any calculated members.

When I open the tab for adding calculated measures an error appear (Italian version): Errore imprevisto: 'Errore dell'applicazione'.

Looking in the event viewer I found some errors.

Source: MSOLAP$LocalCube

The description is not very meaningfull: Internal Error

Has anyone experienced this proble before ?

Any idea how to solve it ?

I tried to edit directly the source xml but don't know the sintax.

Cosimo

Have you by any chance installed Office 2007, but are still running SP1? If so this is a known issue, you can either apply SP2 or use the work around on my blog http://geekswithblogs.net/darrengosbell/archive/2006/11/17/97367.aspx

Monday, March 26, 2012

Problem with aggregation...

I am currently facing 2 problems
1. with calculated cells on my cube. Bascially I have used a Time dimension
broken into year, week and days and a measure which is aggregated as
distinct count
Imagine for 2004, week 52, I have 7 days and the distinct count for all days
are 2, I am not able to see that the total distinct count for week 52 as 14
(7 *2), is there any way to do tat?
2. I also have a caculate measure which rely on the distinct count measure
to calcualte percentages, the returned values for the 7 days in week 52 is
correct, but it's summing up for the total in week 52 which it should be
actaully doing an average.
Can someone help me out with this or at least point out how to go about
doing this? ThanksHello all, I just found out that the 2nd problem is due to the first, but
I'm still trying to figure out how to do a aggregated distinct count value
for my cube. Just to make things clearer, here's an example
Distinct Count Measure
Week 1 Total 3 (<- I need this to be 13)
Days
1 2
2 2
3 1
4 1
5 1
6 3
7 3
I enabled drilldown for the cube and verified that the week1 total is really
a distinct count of 3 only... but what I am really trying to is to count
distinctly for days... but aggregate for Weeks and Years... Is there anyway
to achieve that?
Any form of advise is greatly appreciated... thanks in advance
"Nestor" <test@.test.com> wrote in message
news:Oow6ZqKLFHA.3832@.TK2MSFTNGP12.phx.gbl...
> I am currently facing 2 problems
> 1. with calculated cells on my cube. Bascially I have used a Time
dimension
> broken into year, week and days and a measure which is aggregated as
> distinct count
> Imagine for 2004, week 52, I have 7 days and the distinct count for all
days
> are 2, I am not able to see that the total distinct count for week 52 as
14
> (7 *2), is there any way to do tat?
> 2. I also have a caculate measure which rely on the distinct count measure
> to calcualte percentages, the returned values for the 7 days in week 52 is
> correct, but it's summing up for the total in week 52 which it should be
> actaully doing an average.
>
> Can someone help me out with this or at least point out how to go about
> doing this? Thanks
>|||You can use Calculated Member or Calculated Cell.
If you use Calculated Member,
Dcount = IIF(Time.CurrentMember.Level.Name = "Day", [Distinct Count
Measure], Sum(Time.CurrentMember.Children, [Dcount]))
Or if you use Calculated Cell,
Calculation Subcube: {[Measures].[Distinct Count Measure]},
Descendants(Time.Year.Members, Week, SELF_AND_BEFORE)
Calculation Value: Sum(Time.CurrentMember.Children, [Distinct Count
Measure])
But this is the case when you consider only time dimension. I'm not sure you
have to consider more dimensions.
Ohjoo Kwon
"Nestor" <test@.test.com> wrote in message
news:u$nyDYVLFHA.3988@.tk2msftngp13.phx.gbl...
> Hello all, I just found out that the 2nd problem is due to the first, but
> I'm still trying to figure out how to do a aggregated distinct count value
> for my cube. Just to make things clearer, here's an example
> Distinct Count Measure
> Week 1 Total 3 (<- I need this to be 13)
> Days
> 1 2
> 2 2
> 3 1
> 4 1
> 5 1
> 6 3
> 7 3
> I enabled drilldown for the cube and verified that the week1 total is
really
> a distinct count of 3 only... but what I am really trying to is to count
> distinctly for days... but aggregate for Weeks and Years... Is there
anyway
> to achieve that?
> Any form of advise is greatly appreciated... thanks in advance
>
> "Nestor" <test@.test.com> wrote in message
> news:Oow6ZqKLFHA.3832@.TK2MSFTNGP12.phx.gbl...
> dimension
> days
> 14
measure[vbcol=seagreen]
is[vbcol=seagreen]
>|||Thanks a lot of the help Ohjoo, I'm using calculated member and I'm
inputting the MDX statement into the ValuedExpression, basically this is the
MDX i've keyed into the Value Expression
iif
([My Time].CurrentMember.Level.Name = "Day",
[Measures].[Distinct Products],
iif([My Time].CurrentMember.Level.Name = "Year",
sum([My Time].CurrentMember.Children, [Measures].[New Calculated
Measure]), <-- Error here
sum([My Time].CurrentMember.Children, [Measures].[Distinct
Products])
)
)
What I am trying to do is to count distinctly for days only, for weeks it
should aggregate the days distinct count and for years it should aggregate
the weeks sum. The calculated measure is simply called "New Calculated
Measure"
Can this be done?
count(distinct(<measure to count> ), exlcudeempty)
"Ohjoo Kwon" <ojkwon@.olap.co.kr> wrote in message
news:OWnHDMWLFHA.2796@.tk2msftngp13.phx.gbl...
> You can use Calculated Member or Calculated Cell.
> If you use Calculated Member,
> Dcount = IIF(Time.CurrentMember.Level.Name = "Day", [Distinct Count
> Measure], Sum(Time.CurrentMember.Children, [Dcount]))
> Or if you use Calculated Cell,
> Calculation Subcube: {[Measures].[Distinct Count Measure]},
> Descendants(Time.Year.Members, Week, SELF_AND_BEFORE)
> Calculation Value: Sum(Time.CurrentMember.Children, [Distinct Count
> Measure])
> But this is the case when you consider only time dimension. I'm not sure
> you
> have to consider more dimensions.
> Ohjoo Kwon
>
> "Nestor" <test@.test.com> wrote in message
> news:u$nyDYVLFHA.3988@.tk2msftngp13.phx.gbl...
> really
> anyway
> measure
> is
>|||Next is simpler.
IIF(Time.CurrentMember.Level.Name = "Day",
[Distinct Products],
Sum(Time.CurrentMember.Children, [New Calculated Measure])
)
Ohjoo
"Nestor" <n3570r@.yahoo.com> wrote in message
news:OT2O0gbLFHA.1156@.TK2MSFTNGP09.phx.gbl...
> Thanks a lot of the help Ohjoo, I'm using calculated member and I'm
> inputting the MDX statement into the ValuedExpression, basically this is
the
> MDX i've keyed into the Value Expression
> iif
> ([My Time].CurrentMember.Level.Name = "Day",
> [Measures].[Distinct Products],
> iif([My Time].CurrentMember.Level.Name = "Year",
> sum([My Time].CurrentMember.Children, [Measures].[New[/vbc
ol]
Calculated[vbcol=seagreen]
> Measure]), <-- Error here
> sum([My Time].CurrentMember.Children, [Measures].[
Distinct
> Products])
> )
> )
>
> What I am trying to do is to count distinctly for days only, for weeks it
> should aggregate the days distinct count and for years it should aggregate
> the weeks sum. The calculated measure is simply called "New Calculated
> Measure"
> Can this be done?
>
> count(distinct(<measure to count> ), exlcudeempty)
>
> "Ohjoo Kwon" <ojkwon@.olap.co.kr> wrote in message
> news:OWnHDMWLFHA.2796@.tk2msftngp13.phx.gbl...
but[vbcol=seagreen]
count[vbcol=seagreen]
all[vbcol=seagreen]
52[vbcol=seagreen]
about[vbcol=seagreen]
>|||thanks a lot Ohjoo, you've been of great assistances...
"Ohjoo Kwon" <ojkwon@.olap.co.kr> wrote in message
news:%23jpmrEcLFHA.2136@.TK2MSFTNGP14.phx.gbl...
> Next is simpler.
> IIF(Time.CurrentMember.Level.Name = "Day",
> [Distinct Products],
> Sum(Time.CurrentMember.Children, [New Calculated Measure])
> )
> Ohjoo
>
> "Nestor" <n3570r@.yahoo.com> wrote in message
> news:OT2O0gbLFHA.1156@.TK2MSFTNGP09.phx.gbl...
> the
> Calculated
> but
> count
> all
> 52
> about
>