2015-01-30 3 views
0

사실 테이블 하나와 차원 (날짜, 제품, 상점 및 국가)이 4 개인 큐브가 있습니다. 치수는 평소와 같이 주요 외래 키를 사용하여 사실에 연결됩니다.MDX를 사용하여 큐브의 차원 만 쿼리

차원 정보 만 가져 오기 위해이 모델을 쿼리하려고합니다. 즉, 사실 테이블 열은 필요하지 않습니다. 예를 들어 모든 국가의 모든 상점 상태 (활성/비활성)를보고 싶습니다.

내가 작성한 쿼리는

WITH 
MEMBER [Dim shop.Shop id].[Shop count] AS 
    Count([Dim shop.Shop id].Members, EXCLUDEEMPTY) --select the count of shop members 

SET [~ROWS_Dim country.Country name] AS 
    {[Dim country.Country name].[Country name].Members} --All countries 

SET [~ROWS_Dim shop.Status] AS 
    {[Dim shop.Status].[Status].Members} --All shop statuses 
SELECT 
NON EMPTY [Dim shop.Shop id].[Shop count] ON COLUMNS, 
NON EMPTY NonEmptyCrossJoin([~ROWS_Dim country.Country name], [~ROWS_Dim shop.Status]) ON ROWS 
FROM [cube] 
WHERE ({[Dim shop.Date to].[2199-12-31 22:59:59.999],[Dim shop.Date to].[2199-12-31 23:59:59.999]}) --Slicing to get only currently inventoried shops 

스키마는 쿼리가 실행

<Schema name="cube"> 
    <Dimension name="Dim country"> 
    <Hierarchy name="Cid" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Cid" uniqueMembers="false" column="cid" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Country code name" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Country code name" uniqueMembers="false" column="country_code_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Country currency" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Country currency" uniqueMembers="false" column="country_currency" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Country ga id" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Country ga id" uniqueMembers="false" column="country_ga_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Country name" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Country name" uniqueMembers="false" column="country_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date from" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Date from" uniqueMembers="false" column="date_from"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date to" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Date to" uniqueMembers="false" column="date_to"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Version" hasAll="true" primaryKey="cid"> 
     <Table name="dim_country" schema="dw_pp"/> 
     <Level name="Version" uniqueMembers="false" column="version" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    </Dimension> 
    <Dimension name="Dim date"> 
    <Hierarchy name="Calendar month" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Calendar month" uniqueMembers="false" column="calendar_month" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Calendar month name" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Calendar month name" uniqueMembers="false" column="calendar_month_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Calendar week" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Calendar week" uniqueMembers="false" column="calendar_week" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Calendar year" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Calendar year" uniqueMembers="false" column="calendar_year" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Date" uniqueMembers="false" column="date"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date key" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Date key" uniqueMembers="false" column="date_key" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Day of month" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Day of month" uniqueMembers="false" column="day_of_month" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Day of week" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Day of week" uniqueMembers="false" column="day_of_week" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Day of week name" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Day of week name" uniqueMembers="false" column="day_of_week_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Day of year" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Day of year" uniqueMembers="false" column="day_of_year" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Quarter" hasAll="true" primaryKey="date_key"> 
     <Table name="dim_date" schema="dw_pp"/> 
     <Level name="Quarter" uniqueMembers="false" column="quarter" type="String"> 
     </Level> 
    </Hierarchy> 
    </Dimension> 
    <Dimension name="Dim product"> 
    <Hierarchy name="Brand" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Brand" uniqueMembers="false" column="brand" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Category id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Category id" uniqueMembers="false" column="category_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Category name" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Category name" uniqueMembers="false" column="category_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Code" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Code" uniqueMembers="false" column="code" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Created" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Created" uniqueMembers="false" column="created"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Created by" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Created by" uniqueMembers="false" column="created_by" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date from" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Date from" uniqueMembers="false" column="date_from"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date to" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Date to" uniqueMembers="false" column="date_to"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Ean" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Ean" uniqueMembers="false" column="ean" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location high" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Image location high" uniqueMembers="false" column="image_location_high" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location low" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Image location low" uniqueMembers="false" column="image_location_low" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location thumb" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Image location thumb" uniqueMembers="false" column="image_location_thumb" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Last modified by price" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Last modified by price" uniqueMembers="false" column="last_modified_by_price" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Last modifiedby product" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Last modifiedby product" uniqueMembers="false" column="last_modifiedby_product" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Level0 parent category id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Level0 parent category id" uniqueMembers="false" column="level0_parent_category_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Level0 parent category name" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Level0 parent category name" uniqueMembers="false" column="level0_parent_category_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Level1 parent category id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Level1 parent category id" uniqueMembers="false" column="level1_parent_category_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Level1 parent category name" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Level1 parent category name" uniqueMembers="false" column="level1_parent_category_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Manufacturer id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Manufacturer id" uniqueMembers="false" column="manufacturer_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Modified product" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Modified product" uniqueMembers="false" column="modified_product"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Price" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Price" uniqueMembers="false" column="price" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Price with shipping" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Price with shipping" uniqueMembers="false" column="price_with_shipping" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product currency code" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product currency code" uniqueMembers="false" column="product_currency_code" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product id" uniqueMembers="false" column="product_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product info id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product info id" uniqueMembers="false" column="product_info_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product name" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product name" uniqueMembers="false" column="product_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product page type" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product page type" uniqueMembers="false" column="product_page_type" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Product pk" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Product pk" uniqueMembers="false" column="product_pk" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Quality" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Quality" uniqueMembers="false" column="quality" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop active" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Shop active" uniqueMembers="false" column="shop_active" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop id" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Shop id" uniqueMembers="false" column="shop_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop paying" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Shop paying" uniqueMembers="false" column="shop_paying" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Status product" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Status product" uniqueMembers="false" column="status_product" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Tstamp" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Tstamp" uniqueMembers="false" column="tstamp"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Version" hasAll="true" primaryKey="product_pk"> 
     <Table name="dim_product" schema="dw_pp"/> 
     <Level name="Version" uniqueMembers="false" column="version" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    </Dimension> 
    <Dimension name="Dim shop"> 
    <Hierarchy name="Ac id" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Ac id" uniqueMembers="false" column="ac_id" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Ac type" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Ac type" uniqueMembers="false" column="ac_type" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Account status" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Account status" uniqueMembers="false" column="account_status" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Afl network" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Afl network" uniqueMembers="false" column="afl_network" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Afl param" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Afl param" uniqueMembers="false" column="afl_param" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Capping" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Capping" uniqueMembers="false" column="capping" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Co id" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Co id" uniqueMembers="false" column="co_id" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Co name" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Co name" uniqueMembers="false" column="co_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Co type" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Co type" uniqueMembers="false" column="co_type" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Contract number" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Contract number" uniqueMembers="false" column="contract_number" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Contract type" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Contract type" uniqueMembers="false" column="contract_type" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Country code" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Country code" uniqueMembers="false" column="country_code" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Cpc" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Cpc" uniqueMembers="false" column="cpc" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Cpc earning" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Cpc earning" uniqueMembers="false" column="cpc_earning" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Cpo" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Cpo" uniqueMembers="false" column="cpo" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Created" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Created" uniqueMembers="false" column="created"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Currency" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Currency" uniqueMembers="false" column="currency" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date from" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Date from" uniqueMembers="false" column="date_from"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Date to" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Date to" uniqueMembers="false" column="date_to"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Description" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Description" uniqueMembers="false" column="description" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location high" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Image location high" uniqueMembers="false" column="image_location_high" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location low" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Image location low" uniqueMembers="false" column="image_location_low" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Image location thumb" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Image location thumb" uniqueMembers="false" column="image_location_thumb" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Last modifiedby" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Last modifiedby" uniqueMembers="false" column="last_modifiedby" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Modified" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Modified" uniqueMembers="false" column="modified"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="No deep links" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="No deep links" uniqueMembers="false" column="no_deep_links" type="Boolean"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Opening hours" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Opening hours" uniqueMembers="false" column="opening_hours" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Pay status" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Pay status" uniqueMembers="false" column="pay_status" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Score" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Score" uniqueMembers="false" column="score" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shipping details" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Shipping details" uniqueMembers="false" column="shipping_details" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shipping fee" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Shipping fee" uniqueMembers="false" column="shipping_fee" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop id" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Shop id" uniqueMembers="false" column="shop_id" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop name" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Shop name" uniqueMembers="false" column="shop_name" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Shop pk" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Shop pk" uniqueMembers="false" column="shop_pk" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Start date" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Start date" uniqueMembers="false" column="start_date"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Status" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Status" uniqueMembers="false" column="status" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Target country" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Target country" uniqueMembers="false" column="target_country" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Type" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Type" uniqueMembers="false" column="type" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Url" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Url" uniqueMembers="false" column="url" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Url policy" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Url policy" uniqueMembers="false" column="url_policy" type="String"> 
     </Level> 
    </Hierarchy> 
    <Hierarchy name="Version" hasAll="true" primaryKey="shop_pk"> 
     <Table name="dim_shop" schema="dw_pp"/> 
     <Level name="Version" uniqueMembers="false" column="version" type="Numeric"> 
     </Level> 
    </Hierarchy> 
    </Dimension> 
    <Cube name="cube"> 
    <Table name="fc_analytics" schema="dw_pp"/> 
    <DimensionUsage name="Dim country" source="Dim country" foreignKey="country_fk"/> 
    <DimensionUsage name="Dim date" source="Dim date" foreignKey="date_fk"/> 
    <DimensionUsage name="Dim product" source="Dim product" foreignKey="product_fk"/> 
    <DimensionUsage name="Dim shop" source="Dim shop" foreignKey="shop_fk"/> 
    <Measure name="Country fk" column="country_fk" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Date fk" column="date_fk" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Product fk" column="product_fk" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Ser id" column="ser_id" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Shop fk" column="shop_fk" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Measure1" column="M1" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Measure2" column="M2" aggregator="sum" formatString="&#x23;"/> 
    <Measure name="Measure3" column="M3" aggregator="sum" formatString="&#x23;"/> 
    </Cube> 
</Schema>**strong text** 

아래처럼 보인다. 그러나 값이 잘못되었습니다. 내가 여기서 뭔가를 놓치고 있니?

+0

왜 잘못 되었나요? 스크립트가 오류 메시지와 함께 오류가 있습니까? 또는 실행하지만 잘못된 숫자를 제공합니까? 그것이 당신에게 잘못된 숫자를 준다면 그들에게 잘못된 것이 무엇입니까? – whytheq

답변

0

문제가 내 사실 테이블에있었습니다. 분명히 NonEmptyCrossJoin()가 먼저 팩트 테이블의 스캔을 수행하고 사실 테이블 항목없이 치수 항목을 제외) (

This이 NonEmptyCrossJoin 사용의 위험을 설명합니다 (I 원하지 무엇이다. 나는 독립적으로 치수를 조회 할)

필자는 대신 FILTER (CROSSJOIN (,) AS S, IsEmpty (S.Current)가 아님)를 사용했습니다.

0

이 날은 약간 이상한 파업 :

그것은 측정과 같은
MEMBER [Dim shop.Shop id].[Shop count] AS 
    Count([Dim shop.Shop id].Members, EXCLUDEEMPTY) 

그래서 왜 안 [Measures] 계층 구조에 추가?

MEMBER [Measures].[Shop count] AS 
    Count([Dim shop.Shop id].Members, EXCLUDEEMPTY) 

당신은 측정에 관한 일부 내용을 추가해야 할 수도 있습니다 :

MEMBER [Measures].[Shop count] AS 
    Count(
     nonempty(
     [Dim shop.Shop id].Members 
     ,{[~ROWS_Dim country].currentmember, [~ROWS_Dim shop].currentmember}) 
    ) 
    ) 

I 표준 mdx 몬드리안가 사용할 것을 확실 해요뿐만 아니라 더 나은 키워드 existing와 것 다음

MEMBER [Measures].[Shop count] AS 
    Count(
     nonempty(
     EXISTING [Dim shop.Shop id].Members 
     ,{[~ROWS_Dim country].currentmember, [~ROWS_Dim shop].currentmember}) 
    ) 
    ) 
0

계층 적 ([DimShops]. [Shop Id] .members)