dbTalk Databases Forums  

Re: Trouble using calculate measures

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Re: Trouble using calculate measures in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matt Carroll [MS]
 
Posts: n/a

Default Re: Trouble using calculate measures - 07-11-2003 , 05:10 PM






Try setting the format string of the calulated measure to an appropriate
display format. If you want to convert to integers you can use the VBA
CInt() function.

Also, if you facter out the mileage you can make the calculation a little
easier on the server:
([Measures].[Mileage])*(([Measures].[Total Bookings])/([Measures].[Fixed
Capacity]))

Hope this helps,
- Matt Carroll
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote

Quote:
I'm having trouble to display values for a calculated
measure
when i use this as my MDX: 10/100
it works fine and displays as a decimal when i try and use
MDX to reference Facts in the cube:
([Measures].[Mileage]*[Measures].[Total Bookings])/
([Measures].[Mileage]*[Measures].[Fixed Capacity])

the results are blank cells

do i need to somehow convert these values they should be
all integer values

any ideas??




Reply With Quote
  #2  
Old   
Jason
 
Posts: n/a

Default Re: Trouble using calculate measures - 07-11-2003 , 07:17 PM







I tried using Cdec to no avail could empty cells in the
set be causing this i find the behavior quite strange
Quote:
-----Original Message-----
Try setting the format string of the calulated measure to
an appropriate
display format. If you want to convert to integers you
can use the VBA
CInt() function.

Also, if you facter out the mileage you can make the
calculation a little
easier on the server:
([Measures].[Mileage])*(([Measures].[Total Bookings])/
([Measures].[Fixed
Capacity]))

Hope this helps,
- Matt Carroll
--
This posting is provided "AS IS" with no warranties, and
confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote in message
news:006201c34759$9d4aeae0$a001280a (AT) phx (DOT) gbl...
I'm having trouble to display values for a calculated
measure
when i use this as my MDX: 10/100
it works fine and displays as a decimal when i try and
use
MDX to reference Facts in the cube:
([Measures].[Mileage]*[Measures].[Total Bookings])/
([Measures].[Mileage]*[Measures].[Fixed Capacity])

the results are blank cells

do i need to somehow convert these values they should be
all integer values

any ideas??



.


Reply With Quote
  #3  
Old   
Jason
 
Posts: n/a

Default Re: Trouble using calculate measures - 07-14-2003 , 12:27 PM



Thanks for all the help..

is there any documentation on which VBA functions are
supported on the MSDN site???


Quote:
-----Original Message-----
How about using CDbl()? Not 100% of the VBA functions
are supported in MDX
and it looks like CDec() is one that is not.

- Matt Carroll
--
This posting is provided "AS IS" with no warranties, and
confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote in message
news:0ac901c3480a$fb1472c0$a001280a (AT) phx (DOT) gbl...

I tried using Cdec to no avail could empty cells in the
set be causing this i find the behavior quite strange
-----Original Message-----
Try setting the format string of the calulated measure
to
an appropriate
display format. If you want to convert to integers you
can use the VBA
CInt() function.

Also, if you facter out the mileage you can make the
calculation a little
easier on the server:
([Measures].[Mileage])*(([Measures].[Total Bookings])/
([Measures].[Fixed
Capacity]))

Hope this helps,
- Matt Carroll
--
This posting is provided "AS IS" with no warranties,
and
confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote in message
news:006201c34759$9d4aeae0$a001280a (AT) phx (DOT) gbl...
I'm having trouble to display values for a calculated
measure
when i use this as my MDX: 10/100
it works fine and displays as a decimal when i try
and
use
MDX to reference Facts in the cube:
([Measures].[Mileage]*[Measures].[Total Bookings])/
([Measures].[Mileage]*[Measures].[Fixed Capacity])

the results are blank cells

do i need to somehow convert these values they
should be
all integer values

any ideas??



.



.


Reply With Quote
  #4  
Old   
ygb
 
Posts: n/a

Default Re: Trouble using calculate measures - 07-15-2003 , 06:20 PM




Jason
If you think it's due to empty cells, you may want to use the
CoalesceEmpty function:

http://msdn.microsoft.com/library/de.../en-us/oledb/-
htm/olappr_chapter25_54.asp

Additionally, empty cell topic at MSDN:

http://msdn.microsoft.com/library/de.../en-us/oledb/-
htm/olappr_chapter25_52.asp

As for VBA, MSAS automatically should have registered the VBA
library, so all VBA functionality should be available. Just in case,
here's the list:

Abs(Number As Variant)
Array([ArgList() As Variant])
Asc(String As String)
AscB(String As String)
AscW(String As String)
Atn(Number As Double)
CBool(Expression As Variant)
CByte(Expression As Variant)
CCur(Expression As Variant)
CDate(Expression As Variant)
CDbl(Expression As Variant)
Choose(ParamArray Index As Single, [Choice() As Variant])
Chr(CharCode As Long)
ChrW(CharCode As Long)
CInt(Expression As Variant)
CLng(Expression As Variant)
Cos(Number As Double)
CSng(Expression As Variant)
CStr(Expression As Variant)
CVar(Expression As Variant)
CVDate(Expression As Variant)
Date()
DateAdd(Interval As String, Number As Double, [Date As Variant])
DateDiff(Interval As String, Date1 As Variant, Date2 As Variant)
DatePart(Interval As String, Date As Variant)
DateSerial(Year As Integer, Month As Integer, [Day As Integer])
DateValue(Date As String)
Day(Date As Variant)
DDB(Cost As Double, Salvage As Double, [Life As Double], [Period As
Double], [Factor As Variant])
Exp(Number As Double)
Fix(Number As Variant)
Format(Expression As Variant, Format As Variant)
FV(Rate As Double, NPer As Double, [Pmt As Double], [PV As Variant],
[Due As Variant])
Hex(Number As Variant)
Hour(Time As Variant)
IIf(Expression As Variant, TruePart As Variant, [FalsePart As Variant])
InStr(Start As Variant, String1 As Variant, [String2 As Variant])
Int(Number As Variant)
IPmt(Rate As Double, Per As Double, [NPer As Double], [PV As Double],
[FV As Variant], [Due As Variant])
IsDate(Expression As Variant)
IsEmpty(Expression As Variant)
IsError(Expression As Variant)
IsNull(Expression As Variant)
IsNumeric(Expression As Variant)
IsObject(Expression As Variant)
LCase(String As String)
Left(String As String, [Length As Long])
LeftB(String As String, [Length As Long])
Len(Expression As Variant)
LenB(Expression As Variant)
Log(Number As Double)
LTrim(String As String)
Mid(String As String, [Start As Long], [Length As Variant])
MidB(String As String, [Start As Long], [Length As Variant])
Minute(Time As Variant)
Month(Date As Variant)
Now()
NPer(Rate As Double, Pmt As Double, [PV As Double], [FV As Variant],
[Due As Variant])
Oct(Number As Variant)
Partition(Number As Variant, Start As Variant, [Stop As Variant],
[Interval As Variant])
Pmt(Rate As Double, NPer As Double, [PV As Double], [FV As Variant],
[Due As Variant])
PPmt(Rate As Double, Per As Double, [NPer As Double], [PV As Double],
[FV As Variant], [Due As Variant])
PV(Rate As Double, NPer As Double, [Pmt As Double], [FV As Variant],
[Due As Variant])
QBColor(Color As Integer)
Rate(NPer As Double, Pmt As Double, [PV As Double], [FV As Variant],
[Due As Variant], [Guess As Variant])
RGB(Red As Integer, Green As Integer, [Blue As Integer])
Right(String As String, [Length As Long])
RightB(String As String, [Length As Long])
Rnd([Number As Variant])
Round(Number As Variant, [NumDigitsAfterDecimal As Long])
RTrim(String As String)
Second(Time As Variant)
Sgn(Number As Variant)
Sin(Number As Double)
SLN(Cost As Double, Salvage As Double, [Life As Double])
Space(Number As Long)
Sqr(Number As Double)
Str(Number As Variant)
StrComp(String1 As Variant, String2 As Variant)
String(Number As Long, [Character As Variant])
Switch([VarExpr() As Variant])
SYD(Cost As Double, Salvage As Double, [Life As Double], [Period
As Double])
Tan(Number As Double)
Time()
Timer()
TimeSerial(Hour As Integer, Minute As Integer, [Second As Integer])
TimeValue(Time As String)
Trim(String As String)
TypeName(VarName As Variant)
UCase(String As String)
Val(String As String)
Weekday(Date As Variant)
Year(Date As Variant)

Thanks.
YB.

--
Posted via http://dbforums.com

Reply With Quote
  #5  
Old   
Matt Carroll [MS]
 
Posts: n/a

Default Re: Trouble using calculate measures - 07-16-2003 , 02:53 PM



Lookup "Visual Basic for Applications functions" in books online. This is
probably also on MSDN but I haven't checked.

- Matt Carroll

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote

Quote:
Thanks for all the help..

is there any documentation on which VBA functions are
supported on the MSDN site???


-----Original Message-----
How about using CDbl()? Not 100% of the VBA functions
are supported in MDX
and it looks like CDec() is one that is not.

- Matt Carroll
--
This posting is provided "AS IS" with no warranties, and
confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote in message
news:0ac901c3480a$fb1472c0$a001280a (AT) phx (DOT) gbl...

I tried using Cdec to no avail could empty cells in the
set be causing this i find the behavior quite strange
-----Original Message-----
Try setting the format string of the calulated measure
to
an appropriate
display format. If you want to convert to integers you
can use the VBA
CInt() function.

Also, if you facter out the mileage you can make the
calculation a little
easier on the server:
([Measures].[Mileage])*(([Measures].[Total Bookings])/
([Measures].[Fixed
Capacity]))

Hope this helps,
- Matt Carroll
--
This posting is provided "AS IS" with no warranties,
and
confers no rights.

"Jason" <jhorner (AT) flyfrontier (DOT) com> wrote in message
news:006201c34759$9d4aeae0$a001280a (AT) phx (DOT) gbl...
I'm having trouble to display values for a calculated
measure
when i use this as my MDX: 10/100
it works fine and displays as a decimal when i try
and
use
MDX to reference Facts in the cube:
([Measures].[Mileage]*[Measures].[Total Bookings])/
([Measures].[Mileage]*[Measures].[Fixed Capacity])

the results are blank cells

do i need to somehow convert these values they
should be
all integer values

any ideas??



.



.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.