• 多参与多轴


    WITH
    MEMBER [D_Acct_II].[PID].&[50].[毛利润] AS [D_Acct_II].[PID].&[501]-[D_Acct_II].[PID].&[502]
    MEMBER [D_Acct_II].[PID].&[50].[净利润] AS [D_Acct_II].[PID].&[501]-[D_Acct_II].[PID].&[502]-[D_Acct_II].[PID].&[503]-[D_Acct_II].[PID].&[504]-[D_Acct_II].[PID].&[511]-[D_Acct_II].[PID].&[512]+[D_Acct_II].[PID].&[521]+[D_Acct_II].[PID].&[525]+[D_Acct_II].[PID].&[531]-[D_Acct_II].[PID].&[532]-[D_Acct_II].[PID].&[550]+[D_Acct_II].[PID].&[560]
    member [D_Acct_II].[PID].&[50].[毛利率] AS iif(([D_Acct_II].[PID].&[501],[Measures].[借方])=0 or ([D_Acct_II].[PID].&[501],[Measures].[借方]) is null,null, [D_Acct_II].[PID].&[50].[毛利润]/[D_Acct_II].[PID].&[501])
    member [D_Acct_II].[PID].&[50].[净利率] AS iif(([D_Acct_II].[PID].&[501],[Measures].[借方])=0 or ([D_Acct_II].[PID].&[501],[Measures].[借方]) is null,null, [D_Acct_II].[PID].&[50].[净利润]/[D_Acct_II].[PID].&[501])
    set [KPI] as AddCalculatedmembers(union([D_Acct_II].[PID].&[501],[D_Acct_II].[PID].&[50].[毛利润],[D_Acct_II].[PID].&[50].[毛利率],[D_Acct_II].[PID].&[50].[净利润],[D_Acct_II].[PID].&[50].[净利率],all))

    member [StoreSort] as  iif(([D_Acct_II].[PID].&[501],[Measures].[借方])=0,null,([D_Acct_II].[PID].&[501],[Measures].[借方]))

    member [度量值营业收入] as iif(([KPI].Item(0),[Measures].[借方])=0,null,([KPI].Item(0),[Measures].[借方]))
    member [度量值毛利润]   as ([KPI].Item(1),[Measures].[借方])
    member [度量值毛利率]   as ([KPI].Item(2),[Measures].[借方])
    member [度量值净利润]   as ([KPI].Item(3),[Measures].[借方])
    member [度量值净利率]   as ([KPI].Item(4),[Measures].[借方])

    member [独立营业收入] as iif([Measures].[借方]=[度量值营业收入],[度量值营业收入],null)
    member [独立毛利润] as iif([Measures].[借方]=[度量值毛利润],[度量值毛利润],null)
    member [独立毛利率] as iif([Measures].[借方]=[度量值毛利率],[度量值毛利率],null)
    member [独立净利润] as iif([Measures].[借方]=[度量值净利润],[度量值净利润],null)
    member [独立净利率] as iif([Measures].[借方]=[度量值净利率],[度量值净利率],null)

    member [金额] as iif([Measures].[借方]=0,null,[Measures].[借方])

    SELECT
     NON EMPTY {[StoreSort], [金额],[独立营业收入],[独立毛利润],[独立毛利率],[独立净利润],[独立净利率]  } ON COLUMNS
    ,NON EMPTY { filter([KPI]*[D_Store].[门店].members*[D_Department].[门店].members,[D_Store].[门店].currentmember.name<>"All" and [D_Department].[门店].currentmember.name<>"All")
    } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, PARENT_UNIQUE_NAME, LEVEL_NUMBER ON ROWS


    from

        (
        SELECT ( STRTOSET(@TimeYM, CONSTRAINED) ) ON COLUMNS 
            FROM
                (
        SELECT ( STRTOSET(@StoreST, CONSTRAINED) ) ON COLUMNS 
                    FROM  [XXX]

                )

    WHERE (
    IIF( STRTOSET(@StoreST, CONSTRAINED).Count = 1, STRTOSET(@StoreST, CONSTRAINED), [D_Store].[门店].currentmember ))
    )
    where (
    IIF( STRTOSET(@TimeYM, CONSTRAINED).Count = 1, STRTOSET(@TimeYM, CONSTRAINED), [D_Date].[年月].currentmember ))

     

    说明:

    1、[度量值毛利润]等指标是为了过渡,得到[独立毛利润] ;

    2、[独立毛利润] 用于Chart中在一张图中使用多轴。

  • 相关阅读:
    Vue的条件渲染详解
    Vue的style绑定
    Vue的class绑定总结
    v-model详解
    MUI手势锁
    mysql主从搭建
    处理绿盟科技安全评估的系统漏洞
    微信小程序发送ajax
    微信小程序上拉下拉刷新
    微信小程序覆盖自定义组件样式
  • 原文地址:https://www.cnblogs.com/chunshen/p/2557031.html
Copyright © 2020-2023  润新知