Академический Документы
Профессиональный Документы
Культура Документы
*** tuples ()- In the Excel sheet a cell is identified by A1, A2, A3, B1, B2, B3,
etc. Here A represents a coordinate from the columns and 1 represents a coordinate
from the rows. We put these together and we can uniquely identify a cell in the
sheet. Here A1, B1 are examples of tuples. In a OLAP cube there are many dimensions
and a tuple is defined as a list of a single hierarchy member taken from all the
dimensions (e.g. [New York], [2009]). The net effect is the same.
*** Sets {}- are an ordered collection of 0 or more tuples (note that a member is
considered to be a tuple containing a single element) with the same
dimensionality.Sets are defined using curled brackets:
{ [Geography].[Geo].[Europe].[Switzerland], [Geography].[Geo].[Europe].[France] }
Members of a set must be from the same hierarchy.
*** current member & default member can not be used with hierarchy levels.it will
through error: ex
[ds_emp_hcatlog].[H_ds_emp_hcatlog].currentmember -- this will work
[ds_emp_hcatlog].[H_ds_emp_hcatlog].deptname.currentmember -- this won't work
***
### allmembers = it is used to get the all values of any dimension attributes. eg.
OR
Practice:
---------
Select [Measures].[Throughput_time] on columns From [cube_cimpress]
OR
select
[Measures].[empid] on columns,
{[ds_emp_hcatlog].[H_ds_emp_hcatlog].[deptname].[1].nextmember,[ds_emp_hcatlog].
[H_ds_emp_hcatlog].[deptname].[1]} on rows
from [cube_emp_hcatlog]
Surcharge_NonAdd:
case when ISALL([Rate Types].[H_Rate].currentmember) then 0
when [Rate Types].[H_Rate]. CURRENTMEMBER.MEMBERVALUE= 'JFK' then 15
when [Rate Types].[H_Rate]. CURRENTMEMBER.MEMBERVALUE= 'Newark' then 10 else 0 end
Window function:
----------------
iif([Measures].[empid] = null ,null ,([Deptno_Dim].[deptno].CurrentMember,
[Empid_Dim].[empid].DefaultMember,[Measures].[empid]))
Avg_Function Implementation for walgreens: Ignore blank/null/etc
------------------------------------------
iif([avg_sum_cal_for_null_etc].[H_avg_sum_cal_for_null_etc].CurrentMember is
[avg_sum_cal_for_null_etc].[H_avg_sum_cal_for_null_etc].DefaultMember ,
Sum(Filter([avg_sum_cal_for_null_etc].[H_avg_sum_cal_for_null_etc].
[Avg_Without_Null_etc] , [avg_sum_cal_for_null_etc].
[H_avg_sum_cal_for_null_etc].CurrentMember.name = "Y"),[Measures].
[sal_sum])/Count(Filter([avg_sum_cal_for_null_etc].[H_avg_sum_cal_for_null_etc].
[Avg_Without_Null_etc] , [avg_sum_cal_for_null_etc].
[H_avg_sum_cal_for_null_etc].CurrentMember.name = "Y")) , [Measures].[sal_avg])
***********************************************************************************
************************
HomeAway:
---------
To calculate Gross Acceptance rate:
Logic:
If "Current OLB Status Flag" = "OLB" then [Gross Property Nights] / total of
[Measures].[Booking Request Nights]
else if it is ALL then [Gross Property Nights] / total of [Measures].[Booking
Request Nights]
else "NULL"
iif(
([Listing Point In Time].[OLB Status Flag].CurrentMember.name = 'OLB'),
[Measures].[Gross Property Nights]/([Listing Point In Time].[OLB Status
Flag].DefaultMember,[Measures].[Booking Request Nights]),
iif(([Listing Point In Time].[OLB Status Flag].CurrentMember is [Listing Point In
Time].[OLB Status Flag].DefaultMember),
([Listing Point In Time].[OLB Status Flag].&[OLB],[Measures].[Gross Property
Nights])/([Listing Point In Time].[OLB Status Flag].DefaultMember,[Measures].
[Booking Request Nights]),
null))
***********************************************************************************
************************
UBS:
----
Folder - Pradeep
cube Name - cube_emp_hcatlog
### Case
with member [TEST]
as CASE
WHEN [reason].[r_reason_desc].currentmember.membervalue="Did not fit" THEN 'SIZE
ISSUE'
WHEN [reason].[r_reason_desc].currentmember.membervalue="Did not get it on time"
THEN 'TIME ISSUE'
ELSE 'OTHER'
END
select
{[Measures].[ss_ext_wholesale_cost_SUM],[TEST] }
on columns,
[reason].[r_reason_desc].allmembers
on rows
from [StoreSalesReturnsV29]
### Currentmember
select
{[Measures].[empid],[Measures].[Column_1]}
on columns,
[Empid_Dim].[empid] on rows
from [cube_emp_hcatlog]
### Empty
### Firstchild
select
[Measures].[sal] on columns,
FIRSTCHILD([DOB].[H_DOB].[Year].&[1952]) on rows
from [cube_emp_hcatlog]
### Lag
select
[Measures].[ss_ext_wholesale_cost_SUM]
on columns,
LAG([date_dim].[H_date_dim].[d_year].&[2001],2)
on rows
from [StoreSalesReturnsV29]
### Lastchild
select
[Measures].[sal] on columns,
LASTCHILD([DOB].[H_DOB].[Year].&[1952]) on rows
from [cube_emp_hcatlog]
### Level
with member [Measures].[Column_1]
as LEVEL_NUMBER([DOB].[H_DOB].[Quarter].&[1952]&[2])
select
{[Measures].[sal],[Measures].[Column_1]} on columns,
[DOB].[H_DOB].[Year] on rows
from [cube_emp_hcatlog]
### Multiplication
### PREVIOUSMEMBER
select
[Measures].[ss_ext_wholesale_cost_SUM]
on columns,
PREVIOUSMEMBER([date_dim].[H_date_dim].[d_year].&[2001])
on rows
from [StoreSalesReturnsV29]
### Rank
### Nonempty - Returns the set of tuples that are not empty from a specified set,
based on the cross product of the specified set with a second set.
SELECT [Measures].[sal] ON 0,
NONEMPTY(
[Empid_Dim].[empid].members
, {([DOB].[H_DOB].[Day].&[1960]&[2]&[5]&[1], [Measures].[sal])}
) ON 1
FROM [cube_emp_hcatlog]
OR
iif([COB].[H_COB].members is [COB].[other_date_attr].currentmember,sum([COB].
[H_COB].members,[Measures].[Amount]),null)
Dynamic:
--------
iif(count(GetFilterInfo([Time].[Time])) = 2,
(GetFilterInfo([Time].[Time]).item(1).item(0) -
GetFilterInfo([Time].[Time]).item(0).item(0)),
null)
Tracfone POC:
-------------
### UDMP
iif( [Time_Today].[H_Time_Today].CurrentMember.Properties("run_rate_ratio") = "31"
,[Measures].[Reactivation]
,0)
iif(
[Time_Today].[H_Time_Today].currentmember.level_number = 4
,iif
([Measures].[Gross Adds] <> 0
, [Time_Today].[H_Time_Today].CurrentMember.Properties("run_rate_ratio")
,0)
,0)
CurrentYear:
LASTCHILD([TIME_TODAY].[H_Time_Today].currentmember)
PreviousYear:
LASTCHILD([TIME_TODAY].[H_Time_Today].currentmember).previousmember
CurrentQuarter:
LASTMEMBER([TIME_TODAY].[H_Time_Today].[Quarter])
OR
tail(NONEMPTY([Dates].[Date Y_Q_M_W_D].[Quarter].members)).item(0).item(0)
PreviousQuarter:
LASTMEMBER([TIME_TODAY].[H_Time_Today].[Quarter]).previousmember
OR
tail(NONEMPTY([Dates].[Date Y_Q_M_W_D].
[Quarter].members)).item(0).item(0).previousmember
CurrentMonth:
LASTMEMBER([TIME_TODAY].[H_Time_Today].[Month])
PreviousMonth:
LASTMEMBER([TIME_TODAY].[H_Time_Today].[Month]).previousmember
----------------
getmember([TIME_TODAY].[H_Time_Today].[Year],'1997')
STRTOMEMBER("[TIME_TODAY].[H_Time_Today].[Year].&[�+FORMAT(NOW(), 'YYYY')+�]�)
getmember([TIME_TODAY].[H_Time_Today].[Year],FORMAT(NOW(), 'YYYY'))