Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Calculated filed

Author  Topic 

kishoremcp
Starting Member

41 Posts

Posted - 2013-09-23 : 08:02:42
Hi,

I want to have something like "Laptop Tickets/Total Tickets" in percentage.

I have the following in SSRS existing. As I am new to SSRS and SQL please somebody help me in getting this done.

In Fields in properties of that matrix, Laptop Tickets and Total Tickets are falling under headding Naming and the numbers are named as Mertics.

I hope I am clear.

Thanks in advance..


Naming Metrics month_key
Laptop Tickets 1  Jul-13
Laptop Tickets 11  Jul-13
Laptop Tickets 13  Jul-13
Laptop Tickets 14  Aug-13
Laptop Tickets 4  Aug-13
Laptop Tickets 87  Aug-13
Total Tickets 232  July-13
Total Tickets 343  July-13
Total Tickets 132  Aug-13
Total Tickets 543  Aug-13

i am taking sum while displaying in SSRS. (FYI)




Regards
Kishore

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-09-23 : 13:13:45
use expression like

=IIF(Sum(IIF(Fields!Naming.value="Total Tickets",Fields!Metrics.value,0))>0,Sum(IIF(Fields!Naming.value="Laptop Tickets",Fields!Metrics.value,0))/Sum(IIF(Fields!Naming.value="Total Tickets",Fields!Metrics.value,0)),Nothing)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

kishoremcp
Starting Member

41 Posts

Posted - 2013-09-24 : 01:53:42
Thank you. It seems it is working.
Thank you very much.

:)

quote:
Originally posted by visakh16

use expression like

=IIF(Sum(IIF(Fields!Naming.value="Total Tickets",Fields!Metrics.value,0))>0,Sum(IIF(Fields!Naming.value="Laptop Tickets",Fields!Metrics.value,0))/Sum(IIF(Fields!Naming.value="Total Tickets",Fields!Metrics.value,0)),Nothing)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs




Regards
Kishore
Go to Top of Page

kishoremcp
Starting Member

41 Posts

Posted - 2013-09-24 : 03:01:12
for the above output,
I am trying to find the 1 month change (Sep-13 and Aug-13) sep-aug(minus) with the below formula, but unable to get the result.
=(Sum(IIF(Fields!Month_key.Value = MAX(Fields!Month_key.Value), Fields!Value.Value, 0)) - Sum(IIF(Fields!Month_key.Value = MAX(Fields!Month_key.Value)-1, Fields!Value.Value, 0))) / Sum(IIF(Fields!Month_key.Value = MAX(Fields!Month_key.Value)-1, Fields!Value.Value, 0)) * 1
What is wrong?
What should i change in the expression?

How do i club the two expressions?

Regards
Kishore
Go to Top of Page

kishoremcp
Starting Member

41 Posts

Posted - 2013-09-24 : 03:59:58
I want to calculate the below three fields. I am unable to get those using expressions.
1. 1 Month Change (Current month - Previous month) based on column headings (Laptop Tickets, Total Tickets, and Laptop Tickets as % of Total).
The above are listed under the column name in SSRS as Naming.
2. 12 months average for the same (Laptop Tickets, Total Tickets, and Laptop Tickets as % of Total).
3. 12 months sum also for the same (Laptop Tickets, Total Tickets, and Laptop Tickets as % of Total).

The data is available and the same data is used for this requirement also. So, attaching a screenshot for reference.

Metric Jul-12 Aug-12 Sep-12 Oct-12 Nov-12 Dec-12 Jan-13
Total Tickets 122,230 129,244 122,230 137,360 121,162 99,513 130,827
Laptop Tickets 7,869 5,335 7,869 6,800 4,763 3,601 5,043
Laptop Tickets as % of Total 6% 4% 6% 5% 4% 4% 4%


The percentages are calculated using the expression given by visakh16 above and it is working. I hope I am clear.

I am completely new to SQL and SSRS. So why I need help.

Thanks in advance..


Regards
Kishore
Go to Top of Page
   

- Advertisement -