Thursday, February 16, 2012
calculating values in a matrix report
I have a sales report that uses a Matrix to pivot the data, such that I can
see sales by month and year by customerID
I have Month and year across in columns and customerId on the left in rows.
In the report, how do I show the difference between two values - for
example, for a given customer, I want to compare January this year to Jan
last year and show the diffeence in Dollars or percent.
How can I calculate the difference?
Thanks in advance for your assistance
regards
HabibYou can add static rows to your matrix:
In Layout view, right-click the data, or detail, cell of the matrix, and
then click Add Column or Add Row.
Then populate it with whatever.
"HSalim[MVP]" <hsalim@.msn.com> wrote in message
news:ORG8NevjIHA.4244@.TK2MSFTNGP06.phx.gbl...
> Hi,
> I have a sales report that uses a Matrix to pivot the data, such that I
> can see sales by month and year by customerID
> I have Month and year across in columns and customerId on the left in
> rows.
> In the report, how do I show the difference between two values - for
> example, for a given customer, I want to compare January this year to Jan
> last year and show the diffeence in Dollars or percent.
> How can I calculate the difference?
> Thanks in advance for your assistance
> regards
> Habib
>|||I have a similar situation .
Where you able to do it
Thanks
"HSalim[MVP]" wrote:
> Hi,
> I have a sales report that uses a Matrix to pivot the data, such that I can
> see sales by month and year by customerID
> I have Month and year across in columns and customerId on the left in rows.
> In the report, how do I show the difference between two values - for
> example, for a given customer, I want to compare January this year to Jan
> last year and show the diffeence in Dollars or percent.
> How can I calculate the difference?
> Thanks in advance for your assistance
> regards
> Habib
>
>
Sunday, February 12, 2012
Calculating a delta in a matrix
figuring out how to calculate a delta column in the matrix. The delta is the
difference of current to prior for hot and cold by type. The RS matrix has a
column and row subtotal and a column grand total. I could do the calculation
in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
The last three columns are what i need to get into the matrix.
Current Current Sum Prior Prior Sum Delta Total Delta
Type Strategy Code Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)Here's a better picture of the matrix
Cur CurSum Prior Prior Sum Delta Delta
Type Str Hot Cold Hot Cold Hot Cold
OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
MNP 10 22 32 11 25 36 (1) (3) (4)
OTHR Total 15 32 47 17 37 54 (2) (5) (7)
XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
SBF 25 55 80 27 60 87 (2) (5) (7)
XFOR Total 45 95 140 51 105 156 (4) (10) (14)
Grand Total 60 127 187 68 142 210 (6) (15) (21)
"dbro101" wrote:
> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a problem
> figuring out how to calculate a delta column in the matrix. The delta is the
> difference of current to prior for hot and cold by type. The RS matrix has a
> column and row subtotal and a column grand total. I could do the calculation
> in the SQL statement. Any ideas/solutions on how to do it in the RS matrix?
> The last three columns are what i need to get into the matrix.
> Current Current Sum Prior Prior Sum Delta Total Delta
> Type Strategy Code Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
>|||I have a very similar issue, as posted on 5th July, "Calculations in Matrix
report"
It would appear a delta cannot be calculated within a Matrix. My issue is
currently being investigated to determine whether there is a workaround.
Pete
"dbro101" <dbro101@.discussions.microsoft.com> wrote in message
news:8FA5FF70-523E-4354-80B8-4B94F694E6F2@.microsoft.com...
> Here's a better picture of the matrix
>
> Cur CurSum Prior Prior Sum Delta Delta
> Type Str Hot Cold Hot Cold Hot Cold
> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
> MNP 10 22 32 11 25 36 (1) (3) (4)
> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
> SBF 25 55 80 27 60 87 (2) (5) (7)
> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
> Grand Total 60 127 187 68 142 210 (6) (15) (21)
> "dbro101" wrote:
>> I'm converting a pivot table spreadsheet to a RS matrix. I'm have a
>> problem
>> figuring out how to calculate a delta column in the matrix. The delta is
>> the
>> difference of current to prior for hot and cold by type. The RS matrix
>> has a
>> column and row subtotal and a column grand total. I could do the
>> calculation
>> in the SQL statement. Any ideas/solutions on how to do it in the RS
>> matrix?
>> The last three columns are what i need to get into the matrix.
>> Current Current Sum Prior Prior Sum Delta Total Delta
>> Type Strategy Code Hot Cold Hot Cold Hot Cold
>> OTHR IAG 5 10 15 6 12 18 (1) (2) (3)
>> MNP 10 22 32 11 25 36 (1) (3) (4)
>> OTHR Total 15 32 47 17 37 54 (2) (5) (7)
>> XFOR IAG 20 40 60 22 45 67 (2) (5) (7)
>> SBF 25 55 80 27 60 87 (2) (5) (7)
>> XFOR Total 45 95 140 51 105 156 (4) (10) (14)
>> Grand Total 60 127 187 68 142 210 (6) (15) (21)
Friday, February 10, 2012
Calculated members are unbelievably slow
In general. Need help what are the top items I must check? My client is Excel Pivot table
I have one cal. member [NAV] from one fact table I am getting POSN TOTL CURR NAV BAL PTFC and OWNSHP PRCNTG
cal. mem [NAV] formula is below
Iif(([Investment].CurrentMember.Level.Name = "Investment Cd" or
[Investment].CurrentMember.Level.Name="Investment Type Cd") and
([Investor].CurrentMember.Level.Name="Investor Type Cd" or
[Investor].CurrentMember.Level.Name="Investor Cd" or
[Investor].CurrentMember.Level.Name="Investor Desc") ,
[Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG] ,
Iif([Investment].CurrentMember.Level.Name="Investment Cd" or
[Investment].CurrentMember.Level.Name="Investment Type Cd" ,
[Measures].[POSN TOTL CURR NAV BAL PTFC] ,
Iif(([Investor].CurrentMember.Level.Name="Investor Type Cd" or
[Investor].CurrentMember.Level.Name="Investor Cd" or
[Investor].CurrentMember.Level.Name="Investor Desc") ,
[Measures].[POSN TOTL CURR NAV BAL FUND] ,
Sum({[Investor].AllMembers}, [Measures].[POSN TOTL CURR NAV BAL FUND]))))
and hand full of simple calculations like this from different fact table
[Measures].[EQ UP 5P]/[Measures].[NAV]
Thank you - Ashok
Couple of suggestions:
1. Get rid of all IIF's and replace them with SCOPE as explained here: http://www.sqljunkies.com/WebLog/mosha/archive/2007/01/28/iif_performance.aspx
2. Revisit whether Sum({[Investor].AllMembers}, [Measures].[POSN TOTL CURR NAV BAL FUND])) is even correct. I think it isn't. It tries to sum up members from all levels of Investor dimension. This cannot be right. Also, it is going to be constant regardless of the current coordinate in Investor dimension, even though the rest of your expression carefully looks at the current coordinate in Investor.
|||Thanks Mosha,
Because I have more then one IIF and I am new to MDX can I replace my NAV MDX with this ?
SCOPE (([Investment].CurrentMember.Level.Name = "Investment Cd" or [Investment].CurrentMember.Level.Name="Investment Type Cd")
and ([Investor].CurrentMember.Level.Name="Investor Type Cd" or [Investor].CurrentMember.Level.Name="Investor Cd"
or [Investor].CurrentMember.Level.Name="Investor Desc"));
This = [Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG];
SCOPE ([Investment].CurrentMember.Level.Name="Investment Cd" or [Investment].CurrentMember.Level.Name="Investment Type Cd");
This = [Measures].[POSN TOTL CURR NAV BAL PTFC];
SCOPE ([Investor].CurrentMember.Level.Name="Investor Type Cd" or [Investor].CurrentMember.Level.Name="Investor Cd" or
[Investor].CurrentMember.Level.Name="Investor Desc"));
This = [Measures].[POSN TOTL CURR NAV BAL FUND];
SCOPE ([Investor].AllMembers)
This = [Measures].[POSN TOTL CURR NAV BAL FUND];
END SCOPE;
Thank you - Ashok
I just tried this and I am getting syntax error
CREATE MEMBER CURRENTCUBE.[MEASURES].[NAV]
AS SCOPE ([Investor].AllMembers);
This = [Measures].[POSN TOTL CURR NAV BAL PTFC] * [Measures].[OWNSHP PRCNTG];
END SCOPE;,
VISIBLE = 1 ;
|||
Looks like you are still learning the syntax of MDX scripts. Here are two resources which have examples of how to convert IIF to SCOPE:
1. AS2005 Performance Guide http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SSAS2005PerfGuide.doc. (look for the MDX optimization section)
2. This blog also has an example: http://www.sqljunkies.com/WebLog/mosha/archive/2006/11/05/non_empty_behavior.aspx