Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

how to sort in group when have many column dimensions use mdx?

$
0
0

as the follow image,how to sort YFdim(the third row dimension)accroding to the first data column([单价合同][上海分公司][amount] which marked with a circle).

 i tried two with the following mdx,but the data order was wrong in the rectangle.

any one help me,please?

Mdx:   

 with 
 set billstate as  {[BillStateDim].[BillState].[审批中],[BillStateDim].[BillState].[已提交]} 
 set BillType as  {[ContractBillDim].[BillType].[设备租赁合同],[ContractBillDim].[BillType].[物资租赁合同],[ContractBillDim].[BillType].[物资采购合同],[ContractBillDim].[BillType].[设备采购合同]}
 set yifang as  {[YFDim].[MatPurchaseContract].[乙方7],[YFDim].[MatPurchaseContract].[乙方4],[YFDim].[MatPurchaseContract].[乙方1]}

 SELECT {
CROSSJOIN(
{[ContractTypeDim].[ContractType].[单价合同],[ContractTypeDim].[ContractType].[总价合同]},
{[DeptDim].[Dept].[广联达],[DeptDim].[Dept].[北京分公司],[DeptDim].[Dept].[海外市场]},
{[MEASURES].[Amount]}
)
} ON COLUMNS, 
// {CROSSJOIN(billstate,BillType,order(yifang,[MEASURES].[Amount],asc))} ON ROWS //the second parameter of order function i tried these two way,but no effect 
 {CROSSJOIN(billstate,BillType,order(yifang,([ContractTypeDim].[ContractType].[单价合同],[DeptDim].[Dept].[广联达],[MEASURES].[Amount]),asc))} ON ROWS 
  FROM [ContractTheme] 

Query Result as follow image:



Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>