_____________________ 2007 ______________ 2008___________
ITEM NAME________SUM(PRICE)________SUM(PRICE)________
I would like to add an additional column to calculate the difference
in the 2 columns.
_________________ 2007 ____________ 2008___________Diff
Sample 1________ $1000 ________$1500_________ + 500
Sample 2________ $1000 ________$2000_________ + 1000
Seems simple enough but I can't seem to figure it out. Does anyone know how
to do this
or can point me to a resource/tutorial that would help. thanks.
The third option isn't pretty, but it can come in handy for some very
complex stuff. For a simple sum I would either (a) keep the matrix and solve
it in the datsource or (b) use a table
hope this helps
Rows being returned via a SQL union are as follows:
Sample1 2007 1000
Sample1 2008 1500
Sample2 2007 1000
Sample2 2008 2000
I can't seem to figure out how to do the calculation via SQL since my result
set is actually a union from a bunch of different tables. One result has the
2007 data (row) while the other gets the 2008 data (row) from an entirely
different set of tables. Option C sounds interesting but since I lack RS
experience it's pretty daunting.
Rich
"Antoon" <Ant...@discussions.microsoft.com> wrote in message
news:0E3602FB-D4F6-43ED...@microsoft.com...
Solution (1):
I understand your sql is somthing like
Select name, year, value from ...
union
Select ... from ...
lets call this <your sql>
the sql would the become
(<your sql>)
union
(
Select b.name, 0 , b.value - a.value
from
( <your sql> ) a,
( <your sql> ) b
where
a.name = b.name and
a.year = b.year-1
)
This is not very efficient, you could improve by using a temporary table to
store <your sql> in.
SerName weight(2006) weight(2007)Difference % Rank
a 1000 2000 1000
b 200 500 300
I tried to create report in the table format, but I couldn't give this lay out after filtering by year.
I was able to give this layout with the matrix, but I cannot add a column in the matrix for the difference.
I know there has to be some way to do this with the MDX query. I tried this query:
SELECT
{ [Time].[Fiscal Year].&[2007] ,
[Time].[Fiscal Year].&[2008] }
ON COLUMNS,
[Customer].[Ser].MEMBERS ON ROWS
FROM [cube]
WHERE ([Measures].[weight])
Here is the error I received:”Query preparation failed. Additional information: Failed to parse the query to detect if it is MDX or DMX. (MDXQueryGenerator)."
Tried the following suggestion without any positive result
In order to write a drill through query, choose to manually enter a DMX query.
1. Start with a blank dataset query against a Microsoft SQL Server Analysis Services type source
2. Use the dataset toolbar to change from "MDX" to a "DMX" type query
3. Use the dataset toolbar to switch "Design Mode" so it is possible to enter MDX manually
The query should now run without the parser complaining.
I appreciate any suggestions