Crosstab Query Calculation

B

Bart

I have an output from my crosstab query below

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

But I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

should I do the calculation on the report? Or on the query? How Should I do
this?
 
K

KARL DEWEY

Build a query that gives you the full total (46 in this case) and join in the
crosstab query.
Then add anothe column heading for the percent presentation same like the
total. It will use the row total divided into the full total.
 
B

Bart

Hi Karl!

Thanks. Sorry but I dont get it.

KARL DEWEY said:
Build a query that gives you the full total (46 in this case) and join in the
crosstab query.
Then add anothe column heading for the percent presentation same like the
total. It will use the row total divided into the full total.
 
B

Bart

here is the sample output:

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

and I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

here is the sql...
TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No]
FROM [Resolution Rate]
GROUP BY [Resolution Rate].Overall
PIVOT [Resolution Rate].Status;
 
K

KARL DEWEY

Use the totals query and the modified crosstab below --
Bart_Total ---
SELECT Count([Resolution Rate].[Ref No]) AS Total_All,
Sum(IIf([Overall]="Beyond",1,0)) AS Beyond_1,
Sum(IIf([Overall]="Within",1,0)) AS Within_1
FROM [Resolution Rate];

TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No],
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100 AS [Percent]
FROM [Resolution Rate], Bart_Total
GROUP BY [Resolution Rate].Overall,
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100
PIVOT [Resolution Rate].Status;

--
KARL DEWEY
Build a little - Test a little


Bart said:
here is the sample output:

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

and I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

here is the sql...
TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No]
FROM [Resolution Rate]
GROUP BY [Resolution Rate].Overall
PIVOT [Resolution Rate].Status;

KARL DEWEY said:
Post sample data and the SQL of your crosstab query.
 
B

Bart

I received an error message "Characters found at end of SQL Statement"
appeared when I pasted the SQL

KARL DEWEY said:
Use the totals query and the modified crosstab below --
Bart_Total ---
SELECT Count([Resolution Rate].[Ref No]) AS Total_All,
Sum(IIf([Overall]="Beyond",1,0)) AS Beyond_1,
Sum(IIf([Overall]="Within",1,0)) AS Within_1
FROM [Resolution Rate];

TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No],
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100 AS [Percent]
FROM [Resolution Rate], Bart_Total
GROUP BY [Resolution Rate].Overall,
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100
PIVOT [Resolution Rate].Status;

--
KARL DEWEY
Build a little - Test a little


Bart said:
here is the sample output:

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

and I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

here is the sql...
TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No]
FROM [Resolution Rate]
GROUP BY [Resolution Rate].Overall
PIVOT [Resolution Rate].Status;

KARL DEWEY said:
Post sample data and the SQL of your crosstab query.
--
KARL DEWEY
Build a little - Test a little


:

Hi Karl!

Thanks. Sorry but I dont get it.

:

Build a query that gives you the full total (46 in this case) and join in the
crosstab query.
Then add anothe column heading for the percent presentation same like the
total. It will use the row total divided into the full total.
--
KARL DEWEY
Build a little - Test a little


:

I have an output from my crosstab query below

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

But I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

should I do the calculation on the report? Or on the query? How Should I do
this?
 
K

KARL DEWEY

What I posted was TWO queries and apparently you pasted both into a single
query instead of separate queries.

Bart said:
I received an error message "Characters found at end of SQL Statement"
appeared when I pasted the SQL

KARL DEWEY said:
Use the totals query and the modified crosstab below --
Bart_Total ---
SELECT Count([Resolution Rate].[Ref No]) AS Total_All,
Sum(IIf([Overall]="Beyond",1,0)) AS Beyond_1,
Sum(IIf([Overall]="Within",1,0)) AS Within_1
FROM [Resolution Rate];

TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No],
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100 AS [Percent]
FROM [Resolution Rate], Bart_Total
GROUP BY [Resolution Rate].Overall,
IIf([Overall]="Within",[Within_1],[Beyond_1])/[Total_All]*100
PIVOT [Resolution Rate].Status;

--
KARL DEWEY
Build a little - Test a little


Bart said:
here is the sample output:

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

and I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

here is the sql...
TRANSFORM Count([Resolution Rate].[Ref No]) AS [CountOfRef No]
SELECT [Resolution Rate].Overall, Count([Resolution Rate].[Ref No]) AS
[Total Of Ref No]
FROM [Resolution Rate]
GROUP BY [Resolution Rate].Overall
PIVOT [Resolution Rate].Status;

:

Post sample data and the SQL of your crosstab query.
--
KARL DEWEY
Build a little - Test a little


:

Hi Karl!

Thanks. Sorry but I dont get it.

:

Build a query that gives you the full total (46 in this case) and join in the
crosstab query.
Then add anothe column heading for the percent presentation same like the
total. It will use the row total divided into the full total.
--
KARL DEWEY
Build a little - Test a little


:

I have an output from my crosstab query below

Overall Total Closed Resolved
Beyond 13 12 1
Within 33 31 2

But I want to calculate using below formula
% Beyond = (12+1)/46
% Within = (31+2)/46

should I do the calculation on the report? Or on the query? How Should I do
this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top