MDX按维度值计算度量

时间:2016-01-14 14:53:37

标签: ssas mdx dimensions calculated-field fact

我必须按文章组维度中的值过滤度量值。

起点:

事实:

  • 库存(仅开放一个月的库存)
  • 销售

尺寸:

  • 文章组(内容:文章组类型:服务与否)
  • 文章
  • 时间

我们有两种类型的销售:

  • 标准销售(影响invetory)
  • 服务(不影响库存)

我的MDX脚本动态计算一个月内的每日库存。 问题是服务销售不应该影响库存, 所以我的脚本必须过滤度量值。

如:

@interface UIImage (UIImageCache)

+(UIImage*) cachedImageFile:(NSString*)imageFile;
+(void) resetCacheForImageFile:(NSString*)imageFile;

@end

@implementation UIImage (UIImageCache)

static NSMutableDictionary* cachedImages;

+(UIImage*) cachedImageFile:(NSString*)imageFile {

    // Optional error checking
    NSAssert1([[NSFileManager defaultManager] fileExistsAtPath:imageFile], @"Warning! The image file %@ doesn't exist.", imageFile);

    if (!cachedImages) cachedImages = [NSMutableDictionary dictionary];

    UIImage* cachedImg = [cachedImages objectForKey:imageFile];
    if (cachedImg) return cachedImg; // Image is cached, return it

    else { // No cached image, create one
        UIImage* img = [UIImage imageWithContentsOfFile:imageFile]; // iOS won't auto-cache the image.
        [cachedImages setObject:img forKey:imageFile];
        return img;
    }

}


+(void) resetCacheForImageFile:(NSString*)imageFile {
    [cachedImages removeObjectForKey:imageFile];
}

@end

我不知道如何过滤值

1 个答案:

答案 0 :(得分:1)

试试这个:

CREATE MEMBER CURRENTCUBE.[Measures].[FilteredAmount]
AS ([Measures].[SalesAmount], [Article Group].[Service].&[0]);
-- Service "0" = not service

创建一个只检索多维数据集部分的元组...测量SalesAmount和Service = 0