I want to create aa chart to demonstrate data from mdx query
.
I am using Adomd.net
. I have cube with 3 dimensions Date
, Customer
, Internet Sales Fact
.
I'm using AventureWorkDW2012
. I want to demonstrate sale amount in every quarter in a year so my code is below
string query=@"SELECT [Measures].[Sales Amount] ON COLUMNS,[Order Date].[Hierarchy].[Calendar Year].&[2013].Children ON ROWS
FROM [Adventure Works DW2012]"
AdomdCommand cmd = con.CreateCommand();
cmd.CommandText = query;
AdomdDataAdapter ad = new AdomdDataAdapter(query, con);
DataTable dt = new DataTable();
ad.Fill(dt);
chart1.DataSource = dt;
chart1.Series["Series1"].XValueMember = "[Measures].[Sales Amount]";
chart1.Series["Series1"].YValueMembers = "[Order Date].[Hierarchy].[Calendar Year].&[2013].Children";
That code gives error
Column with name '[Order Date].[Hierarchy].[Calendar Year].&[2013].Children' was not found.
I just found out the error is caused because the chart
just read data from COLUMNS
and my quarter is on ROWS
.
My question is how can I print out the values on ROWS
?
i found the problem.the chart actually still reading data in rows but display it in column. I chose the wrong name to display that why it can't read yvaluemembers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.