Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I am trying to do multiple subtotals in a Pivot table , Any help would be much appreciated.
What I need is as given below:
Type(Row) | Mar | Apr |
A | 10 | 15 |
B | 10 | 20 |
A+B | 20 | 35 |
C | 10 | 25 |
D | 10 | 10 |
Total | 40 | 70 |
Please let me know if this is even possible with table properties or any other solution.
Thanks In Advance
Arpit
Hi,
First A+B needed to be define as a type dimension. in the SQL script.
To do that union all can be used.
First select statement for the table values. Second select statement is for the additional A+B values.
Ex:
In loader script or in the sql side.
Type:
LOAD
Type,APR,MAY;
SQL
SELECT Type , APR, MAY
FROM dbo.TypeVal
UNION ALL
SELECT 'A+B' AS Type , sum(APR) as APR , sum(MAY) as MAY
FROM dbo.TypeVal WHERE Type in ('A','B');
After that, values can be sort by dimension in the editor side manually.
if(Type='A',1,
if(Type='B',2,
if(Type='A+B',3,
if(Type='C',4,
...
))))