日期:2014-05-18 浏览次数:20587 次
with member [Measures].[产品A金额] as sum({[Prod].[Prod_Name].&[产品A]} ,[Measures].[Amount]) member [Measures].[产品A占比] as [Measures].[产品A金额]/[Measures].[Amount] //, FORMAT_STRING ='0.00%' member [Measures].[产品A占比区间] as case when [Measures].[产品A占比]<0.3 then '30%以下' when [Measures].[产品A占比]>=0.3 and [Measures].[产品A占比]<0.5 then '30%至50%' else '50%以上' end select { [Measures].[Amount] ,[Measures].[产品A金额] ,[Measures].[产品A占比] ,[Measures].[产品A占比区间] } on 0 ,non empty [Big_Brand_Cust].[Cust_Name].[Cust_Name] on 1 from [BIG_BRAND_SFE_001] where {[Date].[月份].&[2012-02-01T00:00:00]}
--数据库的表数据是不是有些数据是NULL?判断一下应该就可以了 with member [Measures].[产品A金额] as sum({[Prod].[Prod_Name].&[产品A]} ,[Measures].[Amount]) member [Measures].[产品A占比] as [Measures].[产品A金额]/[Measures].[Amount] //, FORMAT_STRING ='0.00%' member [Measures].[产品A占比区间] as case ISNULL([Measures].[产品A占比],0) when [Measures].[产品A占比]<0.3 then '30%以下' when [Measures].[产品A占比]=0 then '0' when [Measures].[产品A占比]>=0.3 and [Measures].[产品A占比]<0.5 then '30%至50%' else '50%以上' end select { [Measures].[Amount] ,[Measures].[产品A金额] ,[Measures].[产品A占比] ,[Measures].[产品A占比区间] } on 0 ,non empty [Big_Brand_Cust].[Cust_Name].[Cust_Name] on 1 from [BIG_BRAND_SFE_001] where {[Date].[月份].&[2012-02-01T00:00:00]}