keplan

asked on

# MDX Help

Hi,

I've to built a Calculated measures for a CUBE for the following

formular.

PF = kWh/sqrt{(kWh^2)+(kVarh)^2)}

any help on doing this?

I've to built a Calculated measures for a CUBE for the following

formular.

PF = kWh/sqrt{(kWh^2)+(kVarh)^2

any help on doing this?

ASKER

your answer using T-SQL, but, what is the MDX function for these?

Topics SQL Server 2008 ,SQL Server 2005 (you need to choose these carefully to attract the best experts for your particular need: most of us won't base alerts on title, but we do use topics) I'm here due to your choice of topics.)

power in ms-access is the caret, and square root is 'sqr'

my best guess is (& very similar to your input):

PF = kWh / sqr( ( (kWh^2) + (kVarh^2) ) )

power in ms-access is the caret, and square root is 'sqr'

my best guess is (& very similar to your input):

PF = kWh / sqr( ( (kWh^2) + (kVarh^2) ) )

ASKER

is this your answer for ssas MDX?

ASKER

no answer yet? what is going on ee

@keplan

is this syntax for:

1. ms access (a .mdx file)

2. ssas MDX

3. something else

I believe you have may not have attracted the right experts due to the topics chosen

you could request attention for advice from administrators who can alter topics

is this syntax for:

1. ms access (a .mdx file)

2. ssas MDX

3. something else

I believe you have may not have attracted the right experts due to the topics chosen

you could request attention for advice from administrators who can alter topics

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**
@keplan

very sorry I couldn't help here, did you get the formula? Could you share it with us please?

very sorry I couldn't help here, did you get the formula? Could you share it with us please?

ASKER

no solution

Could you try this perhaps?

PF = kWh / ( ( (kWh^2) + (kVarh^2) ) ^0.5 )

notes on precedence.

1a. (kWh^2)

1b. (kVarh^2)

2. ( 1a. + 1b. )

3. ( ( 2. ) ^ 0. 5 ) -- sqr root eqivalent

4. kWh / ( 3. )

= PF

(I hope)

again, sorry about the lack of solution - hopefully this may help

ps: I don't know SSAS MDX at all - hence my reluctance, I was hoping other would step in.

good luck.

If this does help would you let me know?

PF = kWh / ( ( (kWh^2) + (kVarh^2) ) ^0.5 )

MDX does not include a function to obtain the square root of a number. To obtain the square root of a number, raise it to the power of 0.5 using the ^ operatior.http://msdn.microsoft.com/en-us/library/ms144931.aspx

notes on precedence.

1a. (kWh^2)

1b. (kVarh^2)

2. ( 1a. + 1b. )

3. ( ( 2. ) ^ 0. 5 ) -- sqr root eqivalent

4. kWh / ( 3. )

= PF

(I hope)

again, sorry about the lack of solution - hopefully this may help

ps: I don't know SSAS MDX at all - hence my reluctance, I was hoping other would step in.

good luck.

If this does help would you let me know?

assumes [kWh] & [kVarh] are existing fields

e.g.

declare @kWh decimal(18,2)

declare @kVarh float

set @kWh = 1000.0

set @kVarh = 123.0

select @kWh / SQRT( POWER(@kWh,2) + POWER(@kVarh,2) )

= 0.99252026449

http://sqlfiddle.com/#!3/1fa93/6005