Link to home
Create AccountLog in
Avatar of keplan
keplanFlag for Australia

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?
Avatar of PortletPaul
PortletPaul
Flag of Australia image

PF = [kWh] / SQRT( POWER([kWh],2) + POWER([kVarh],2) )

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
Avatar of keplan

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) ) )
Avatar of keplan

ASKER

is this your answer for ssas MDX?
Avatar of keplan

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
ASKER CERTIFIED SOLUTION
Avatar of keplan
keplan
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
@keplan

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

ASKER

no solution
Could you try this perhaps?

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?