How calculate the percentage of area...
Hi,
I have 4 tables:
Tab AREA_TI
LS_ID FL AREA
EMS00046 P01 2.995,09
EMS00046 P02 0,78
EMS00046 PTE 1.435,48
EMS00046 S01 1.684,80
EMS00046 S02 1.694,12
EMS00050 P01 1.111,60
EMS00050 P02 1.054,16
EMS00050 P03 1.117,05
EMS00050 P04 1.087,24
EMS00050 P05 1.117,85
EMS00050 P06 646,99
EMS00050 P07 249,48
EMS00050 PTE 593,35
EMS00050 S01 91,15
EMS00011 P02 446,90
EMS00021 PTE 0,71SUM AREA_TI is:
LS_ID SUM(AREA)
EMS00011 446,90
EMS00021 0,71
EMS00046 7.810
EMS00050 7.068Tab AREA_T0
LS_ID FL AREA
EMS00046 PTE 15,48
EMS00050 PTE 15,33
00001156 P01 3.379,82
00001156 P02 3.731,25
00001156 P03 2.686,88
00001156 PTE 2.279,49
00001156 S01 7.341,05SUM AREA_T0 is:
LS_ID SUM(AREA)
00001156 19.418
EMS00046 15,48
EMS00050 15,33Tab AREA_FI
LS_ID FL AREA
04600411 P01 785,64
04600411 P02 829,72
04600411 P03 832,36
04600411 PCO 11,88
04600411 PTE 473,91
04600411 S01 1.740,42SUM AREA_FI is:
LS_ID SUM(AREA)
04600411 4.673Tab AREA_EM
LS_ID FL AREA
00307374 P01 4.269,59
00307374 P02 8.362,79
00307374 P03 770,96
00307374 PTE 7.292,11
00307374 S01 1.425,90
00602037 P01 3.364,47
00602037 PTE 9.764,71
00602037 S01 75,17SUM AREA_EM is:
LS_ID SUM(AREA)
00307374 22.121
00602037 13.204I'd like to get these results:
LS_ID AREA_TI AREA_T0 AREA_FI AREA_EM AREA_TOT PERC_T0 PERC_FI PERC_TI PERC_EM
EMS00011 446,90 0 0 0 446,90 1
EMS00021 0,71 0 0 0 0,71 1
EMS00046 7810 15,48 0 0 7825,75 0,00197 0,99803
EMS00050 7068 15,33 0 0 7083,33 0,00216 0,99784
00001156 0 19418 0 0 19418 1
04600411 0 0 4673 0 4673 1
00307374 0 0 0 22121 22121 1
00602037 0 0 0 13204 13204 1PERC_T0=AREA_T0/AREA_TOT
PERC_FI=AREA_FI/AREA_TOT
PERC_TI=AREA_TI/AREA_TOT
PERC_EM=AREA_EM/AREA_TOT
I tried this:
CREATE OR REPLACE VIEW PERC_AREA ( LS_ID,
AREA_T0, AREA_FI, AREA_EM, AREA_TI,
AREA_TOT, PERC_T0, PERC_FI, PERC_TI,
PERC_EM ) AS
SELECT A.LS_ID,
SUM(nvl(A.AREA,0)),
SUM(nvl(B.AREA,0)),
SUM(nvl(C.AREA,0)),
SUM(nvl(D.AREA,0)),
SUM(NVL(A.AREA,0)+NVL(B.AREA,0)+NVL(C.AREA,0)+NVL(D.AREA,0)),
SUM(A.AREA)/SUM(NVL(A.AREA,0)+NVL(B.AREA,0)+NVL(C.AREA,0)+NVL(D.AREA,0)),
SUM(B.AREA)/SUM(NVL(A.AREA,0)+NVL(B.AREA,0)+NVL(C.AREA,0)+NVL(D.AREA,0)),
SUM(C.AREA)/SUM(NVL(A.AREA,0)+NVL(B.AREA,0)+NVL(C.AREA,0)+NVL(D.AREA,0)),
SUM(D.AREA)/SUM(NVL(A.AREA,0)+NVL(B.AREA,0)+NVL(C.AREA,0)+NVL(D.AREA,0))
FROM AREA_T0 A, AREA_FI B,AREA_TI C, AREA_EM D
WHERE A.LS_ID=B.LS_ID(+)
AND a.LS_ID=C.LS_ID(+)
AND a.LS_ID=D.LS_ID(+)
GROUP BY A.LS_ID
How can I create a oracle view to get percentage of area FOR ALL LS_ID present in the 4 tables??
Thanks!!!
Hi Barbara
your query seem not correct
I tried this:
CREATE OR REPLACE VIEW X ( LS_ID,
AREA ) AS select ls_id, sum(area_locali) area
from area_ti
group by ls_id
union all
select ls_id, sum(area) area
from area_t0
group by ls_id
union all
select ls_id, sum(area) area
from area_fi
group by ls_id
union all
select ls_id, sum(area) area
from area_em
group by ls_id
create or replace view PERC_AREA
AS
select x.ls_id,
area_ti.sum area_ti,
area_t0.sum area_t0,
area_fi.sum area_fi,
area_em.sum area_em,
area_tot.sum area_tot,
area_t0.sum/area_tot.sum perc_t0,
area_fi.sum/area_tot.sum perc_fi,
area_ti.sum/area_tot.sum perc_ti,
area_em.sum/area_tot.sum perc_em,
round(area_tot.sum*100/area_gen.sum,2) perc_lsid
from (select distinct ls_id
from x) x,
(select ls_id, sum(area) sum
from area_ti
group by ls_id) area_ti,
(select ls_id, sum(area) sum
from area_t0
group by ls_id) area_t0,
(select ls_id, sum(area) sum
from area_fi
group by ls_id) area_fi,
(select ls_id, sum(area) sum
from area_em
group by ls_id) area_em,
(select ls_id, sum(area) sum
from x
group by ls_id) area_tot,
(select sum(area) sum
from x) area_gen
where x.ls_id = area_ti.ls_id(+)
and x.ls_id = area_t0.ls_id(+)
and x.ls_id = area_fi.ls_id(+)
and x.ls_id = area_em.ls_id(+)
and x.ls_id = area_tot.ls_id(+)
What do you think about solution??
Similar Messages
-
How to calculate the percentage of free space for a table in Oracle
okay, I am a little confused here. I have been searching the web and looking at a lot of documents. What I basically want to find out is this, how do I calculate the difference between the number of bytes a table is using and the total bytes allocated to a table space (going that way to get percent free for a particular table). So I need a byte count of a table and total table space and the percentage difference. I have been looking at the DBA_TABLES DBA_TABLESPACES and DBA_SEGMENTS views. I have tried to calculated the space as num_rows * avg_row_len (if I am wrong, let me know). I have been trying to compare that calculation to the number in DBA_TABLESPACES and DBA_SEGMENTS. I am just looking for the total space allocated to the table space that the table sits in (seem logical right now) to make the percentage value work. Thus I want to be able to track the table as it grows as compated to the table space it sits in to see a value as it changes over time (days, weeks, etc.) each time I run this script I am working on.
Can someone get me straight and help me to find out if I am looking in the right places. Any advice would help.
EdwardYou can use a little modified version of dbms_space from Tom, show_space. Have a look,
SQL> create table test222 as select * from all_objects;
Table created.
SQL> delete from test22 where rownum<=100;
delete from test22 where rownum<=100
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> delete from test222 where rownum<=100;
100 rows deleted.
SQL> analyze table test222 compute statistics;
Table analyzed.
SQL> create or replace procedure show_space
2 ( p_segname in varchar2,
3 p_owner in varchar2 default user,
4 p_type in varchar2 default 'TABLE',
5 p_partition in varchar2 default NULL )
6 -- this procedure uses authid current user so it can query DBA_*
7 -- views using privileges from a ROLE and so it can be installed
8 -- once per database, instead of once per user that wanted to use it
9 authid current_user
10 as
11 l_free_blks number;
12 l_total_blocks number;
13 l_total_bytes number;
14 l_unused_blocks number;
15 l_unused_bytes number;
16 l_LastUsedExtFileId number;
17 l_LastUsedExtBlockId number;
18 l_LAST_USED_BLOCK number;
19 l_segment_space_mgmt varchar2(255);
20 l_unformatted_blocks number;
21 l_unformatted_bytes number;
22 l_fs1_blocks number; l_fs1_bytes number;
23 l_fs2_blocks number; l_fs2_bytes number;
24 l_fs3_blocks number; l_fs3_bytes number;
25 l_fs4_blocks number; l_fs4_bytes number;
26 l_full_blocks number; l_full_bytes number;
27
28 -- inline procedure to print out numbers nicely formatted
29 -- with a simple label
30 procedure p( p_label in varchar2, p_num in number )
31 is
32 begin
33 dbms_output.put_line( rpad(p_label,40,'.') ||
34 to_char(p_num,'999,999,999,999') );
35 end;
36 begin
37 -- this query is executed dynamically in order to allow this procedure
38 -- to be created by a user who has access to DBA_SEGMENTS/TABLESPACES
39 -- via a role as is customary.
40 -- NOTE: at runtime, the invoker MUST have access to these two
41 -- views!
42 -- this query determines if the object is a ASSM object or not
43 begin
44 execute immediate
45 'select ts.segment_space_management
46 from dba_segments seg, dba_tablespaces ts
47 where seg.segment_name = :p_segname
48 and (:p_partition is null or
49 seg.partition_name = :p_partition)
50 and seg.owner = :p_owner
51 and seg.tablespace_name = ts.tablespace_name'
52 into l_segment_space_mgmt
53 using p_segname, p_partition, p_partition, p_owner;
54 exception
55 when too_many_rows then
56 dbms_output.put_line
57 ( 'This must be a partitioned table, use p_partition => ');
58 return;
59 end;
60
61
62 -- if the object is in an ASSM tablespace, we must use this API
63 -- call to get space information, else we use the FREE_BLOCKS
64 -- API for the user managed segments
65 if l_segment_space_mgmt = 'AUTO'
66 then
67 dbms_space.space_usage
68 ( p_owner, p_segname, p_type, l_unformatted_blocks,
69 l_unformatted_bytes, l_fs1_blocks, l_fs1_bytes,
70 l_fs2_blocks, l_fs2_bytes, l_fs3_blocks, l_fs3_bytes,
71 l_fs4_blocks, l_fs4_bytes, l_full_blocks, l_full_bytes, p_partition);
72
73 p( 'Unformatted Blocks ', l_unformatted_blocks );
74 p( 'FS1 Blocks (0-25) ', l_fs1_blocks );
75 p( 'FS2 Blocks (25-50) ', l_fs2_blocks );
76 p( 'FS3 Blocks (50-75) ', l_fs3_blocks );
77 p( 'FS4 Blocks (75-100)', l_fs4_blocks );
78 p( 'Full Blocks ', l_full_blocks );
79 else
80 dbms_space.free_blocks(
81 segment_owner => p_owner,
82 segment_name => p_segname,
83 segment_type => p_type,
84 freelist_group_id => 0,
85 free_blks => l_free_blks);
86
87 p( 'Free Blocks', l_free_blks );
88 end if;
89
90 -- and then the unused space API call to get the rest of the
91 -- information
92 dbms_space.unused_space
93 ( segment_owner => p_owner,
94 segment_name => p_segname,
95 segment_type => p_type,
96 partition_name => p_partition,
97 total_blocks => l_total_blocks,
98 total_bytes => l_total_bytes,
99 unused_blocks => l_unused_blocks,
100 unused_bytes => l_unused_bytes,
101 LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId,
102 LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId,
103 LAST_USED_BLOCK => l_LAST_USED_BLOCK );
104
105 p( 'Total Blocks', l_total_blocks );
106 p( 'Total Bytes', l_total_bytes );
107 p( 'Total MBytes', trunc(l_total_bytes/1024/1024) );
108 p( 'Unused Blocks', l_unused_blocks );
109 p( 'Unused Bytes', l_unused_bytes );
110 p( 'Last Used Ext FileId', l_LastUsedExtFileId );
111 p( 'Last Used Ext BlockId', l_LastUsedExtBlockId );
112 p( 'Last Used Block', l_LAST_USED_BLOCK );
113 end;
114
115 /
Procedure created.
SQL> desc show_space
PROCEDURE show_space
Argument Name Type In/Out Default?
P_SEGNAME VARCHAR2 IN
P_OWNER VARCHAR2 IN DEFAULT
P_TYPE VARCHAR2 IN DEFAULT
P_PARTITION VARCHAR2 IN DEFAULT
SQL> set serveroutput on
SQL> exec show_space('TEST222','SCOTT');
BEGIN show_space('TEST222','SCOTT'); END;
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SCOTT.SHOW_SPACE", line 44
ORA-06512: at line 1
SQL> conn / as sysdba
Connected.
SQL> grant sysdba to scott;
Grant succeeded.
SQL> conn scott/tiger as sysdba
Connected.
SQL> exec show_space('TEST222','SCOTT');
BEGIN show_space('TEST222','SCOTT'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'SHOW_SPACE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
SQL> exec scott.show_space('TEST222','SCOTT');
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> exec scott.show_space('TEST222','SCOTT');
Unformatted Blocks ..................... 0
FS1 Blocks (0-25) ..................... 0
FS2 Blocks (25-50) ..................... 1
FS3 Blocks (50-75) ..................... 0
FS4 Blocks (75-100)..................... 1
Full Blocks ..................... 807
Total Blocks............................ 896
Total Bytes............................. 7,340,032
Total MBytes............................ 7
Unused Blocks........................... 65
Unused Bytes............................ 532,480
Last Used Ext FileId.................... 4
Last Used Ext BlockId................... 1,289
Last Used Block......................... 63
PL/SQL procedure successfully completed.
SQL>http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5350053031470
I use this to find the space allocations.
Just read your post again,this is not going to show you the percentage of the free/used space. This is going to be the number of blocks which are free/used. For the growth trend, you can look at (in 10g) Oracle EM. It has added now,Segment Growth Trend report which can show you for each object,comparing to the allocated space to the object,how much space is being used by it.
HTH
Aman.... -
How to calculate the Percentage differencebased on two values
Not sure how to do this.
Just want to calculate the % difference of two values (seem to have a problem when one value is zero)
Here is the current output
49 Apr 2
64 Aug 1
55 Feb 0
Here is the output I would like to see
49 Apr 2 4.08%
64 Aug 1 1.56%
55 Feb 0 0.00%
Here is the current SQL
Select TO_CHAR (RCA_CLOSE_DATE, 'Month') "Month",
SUM (CASE WHEN RCA_CODE = 'BI&D' THEN 1 ELSE 0 END) "BI&D - CBAT No of Adj",
Count(1) as "Count of Adjustments"
from TW_BILL_ADJ_DATA
where (RCA_CLOSE_DATE between nvl (:P8_DATE_FROM,FORM_RECEIVED)
and nvl (:P8_DATE_TO, FORM_RECEIVED))
group by TO_CHAR (RCA_CLOSE_DATE, 'Month')You can try something like this one:
Select TO_CHAR (RCA_CLOSE_DATE, 'Month') "Month",
SUM (CASE WHEN RCA_CODE = 'BI&D' THEN 1 ELSE 0 END) "BI&D - CBAT No of Adj",
Count(1) as "Count of Adjustments",
round(count(1)/SUM(CASE WHEN RCA_CODE = 'BI&D' THEN 1 ELSE 0 END) * 100,2) || '%' percent
from TW_BILL_ADJ_DATA
where (RCA_CLOSE_DATE between nvl (:P8_DATE_FROM,FORM_RECEIVED)
and nvl (:P8_DATE_TO, FORM_RECEIVED))
group by TO_CHAR (RCA_CLOSE_DATE, 'Month')
CODE NOT TESTED !!!
Best Regards
Krystian Zieja / mob -
How can i calculate the percentages and update the progressBar in the splash screen form ?
I created a splash screen form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
namespace GetHardwareInfo
public partial class SplashScreen : Form
public SplashScreen()
InitializeComponent();
private Mutex mutex = new Mutex();
public void SyncedClose()
mutex.WaitOne();
this.Close();
mutex.ReleaseMutex();
public void UpdateProgressBar(int percentage)
if (this.InvokeRequired)
mutex.WaitOne();
if (!IsDisposed)
this.BeginInvoke(new Action<int>(UpdateProgresPRV), percentage);
mutex.ReleaseMutex();
else
UpdateProgresPRV(percentage);
private void UpdateProgresPRV(int per)
if (progressBar1.IsDisposed) return;
progressBar1.Value = per;
private void SplashScreen_Load(object sender, EventArgs e)
The SplashScreen form have in the designer image and on the image a progressBar1.
Then in form1 i did in the top:
List<string> WmiClassesKeys = new List<string>();
IEnumerable<Control> controls;
string comboBoxesNames;
SplashScreen splash = new SplashScreen();
And in the constructor:
controls = LoopOverControls.GetAll(this, typeof(ComboBox));
string[] lines = File.ReadAllLines(@"c:\wmiclasses\wmiclasses1.txt");
foreach (string line in lines)
foreach (ComboBox comboBox in controls.OfType<ComboBox>())
if (line.StartsWith("ComboBox"))
comboBoxesNames = line.Substring(14);
else
if (line.StartsWith("Classes"))
if (comboBox.Name == comboBoxesNames)
comboBox.Items.Add(line.Substring(14));
foreach (ComboBox comboBox in controls.OfType<ComboBox>())
comboBox.SelectedIndex = 0;
The method GetAll is to loop over specific controls:
public static IEnumerable<Control> GetAll(Control control, Type type)
var controls = control.Controls.Cast<Control>();
return controls.SelectMany(ctrl => GetAll(ctrl, type))
.Concat(controls)
.Where(c => c.GetType() == type);
When i'm running the program it's taking some time to make the foreach loops in this time i need to show the SplashScreen and update the progressBar untill the foreach loops over.Don't use Application.Doevents. It's not required and can cause problems.
I do not really grasp the approach you are taking here. So let me make a different suggestion:
SplashScreen:
using System;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
public partial class SplashScreen : Form
private static SplashScreen DefaultInstance;
public SplashScreen()
InitializeComponent();
public static void ShowDefaultInstance()
Thread t = new Thread(TMain);
t.Name = "SplashUI";
t.Start();
public static void CloseDefaultInstance()
DefaultInstance.Invoke(new Action(DefaultInstance.Close));
private static void TMain()
DefaultInstance = new SplashScreen();
DefaultInstance.Show();
Application.Run(DefaultInstance);
public static void UpdateProgress(int Progress)
if (DefaultInstance.InvokeRequired)
DefaultInstance.Invoke(new Action<int>(UpdateProgress), Progress);
else
DefaultInstance.progressBar1.Value = Progress;
Form1:
using System.Windows.Forms;
namespace WindowsFormsApplication1
public partial class Form1 : Form
public Form1()
InitializeComponent();
SplashScreen.ShowDefaultInstance();
for (int i = 1; i<=100; i++)
System.Threading.Thread.Sleep(20); // simulates work
SplashScreen.UpdateProgress(i);
SplashScreen.CloseDefaultInstance();
EDIT: Please note that the progressbar itself is being animated by the system, so it might look slower than it really is. To workaround this, there are solutions available (you'll find them) that first set the value one higher than necessary, then
back to the actual value.
Edit #2: You do need a different thread, otherwise the UI is locked while the loop is running in your Form1's constructor.
Armin -
How to calculate the percentages
Hi Gurus!!
I am having a key figure(say suppose KF1) which had undergone currency conversions in query designer level to USD.
Now i want one more field(KF2) in my report in which i should get the values of percentages based on KF1 and its overall result.
Means i have 1000,2500,3400....under KF1 and the total is 25000. Finally under KF2 i should get as mentioned below
KF1----
>KF2
1000----
>(1000/25000)*100
2500----
>(2500/25000)*100
3400----
>(3400/25000)*100
So like wise i shold get the percentages based on KF1 and its total.
I had tried SUMGT and %GT functions as mentioned below:
kf1/sumgt(kf1) and kf1/%GT(kf1) and for both of them the query is showing errors like you cannot use these functions in the query. correct the query.
Pls suggest me the solution.
Thanks in Advance
Jiten
Edited by: Jitendra Yuddandi on Jun 9, 2009 12:20 PMcheck these links
http://help.sap.com/saphelp_nw04s/helpdata/en/1e/99ea3bd7896f58e10000000a11402f/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/e2/16f13a2f160f28e10000000a114084/frameset.htm -
Using getPixelLocationInImagePlate, how calculate the z axis?
getPixelLocationInImagePlate
this method return the x, y in 3d, but the z axis not found...
how discovery the z axis?
(sorry for the bad english)Hello,
I don't have LV 7 installed so I can't post the VI sorry.. here's the short answer to your question, you have to use property and method nodes from the ActiveX palette (see screen shot), item 0 is scale X, item 1 is scale Y and item 2 is scale Z.
More generally there are loads of threads dedicated to 3D graph issues, just do a forum search .
Hope this helps
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!" -
Calculate the percentage of one number against another
Hi,
I am using Acrobat Standard and would like to calculate a percentage of one number to another, i.e.
Loans
Amount
% Of total loan
Bank
100,000
Other sources
17,000
Total
117,000
100%
I would like to find the two unknown percentages.
I am totally new to Adobe, so please explain in a step by step manner if this is possible.
Thank you in advance for your help.
CazOn the iPad my example looks like this:
To fill the formula down you tap cell and then Fill:
And drag the bottom part of the yellow rectangle down:
Wayne's example would look similar.
SG -
How influence the framework/plot area off a diagram?
Hello together.
I have the following problem. In a report a bar chart is to be represented beside a table. Unfortunately the individual lines of the diagram do not fit the table. A cause is a small framework around the plotting area. How do I become loose this frameworks? Or are there other possibilities? Basis is at present still a BW 3.1 system.
Thanks.hi there
use the color - Tool, select transparent for background and foreground color and click on the control.
Best regards
chris
CL(A)Dly bending G-Force with LabVIEW
famous last words: "oh my god, it is full of stars!" -
How remove the values which are entered in filter attributes of VO
Hi,
On top of one VO we are performing search using bind variables.
To refine the search we have added filterable="true".
Now when we perform seach and then we have filtered using one column we got result and we proceeded.
When we come to this screen again when i perform search with the bindvariable and click on search then the previously applied filter is also getting applied
becuase the value in that filter is still there.
So How can i remove the value which is entered in filter attribute of the VO programatically.
Please help me.
Regards
Gayazwould this help you:
http://adfscopes.blogspot.com/2011/03/programatically-clearing-filter.html -
SAP CPS script to calculate the percentage of number of jobs completed
Hello
I have 2 client specific jobs, which I am executing on 300+ ABAP system using SAP CPS system. I would like to know..
what % of jobs completed successfully & failed.
at present, using the filter method, I get a consolidate jobs status mail. some think like this.
regards
Shridhar GowdaHi Shridhar,
Redwood system maintains statistics for each job Definition.
In job statistcis you can notice Execution Completed Count and Execution Error Count .
You can use Redwood script to pull those statistics
Use following methods to extract them.
getExecutionCompletedCount()
getExecutionErrorCount()
You can write code to get the error percentage and completed percentage.
Hope this helps. -
How to calculate the monthly percentage of the goods delivered
hi all,
In my requirement i have to count the number of goods delivered to the customer per year and i have the calculate the percentage of goods delivered monthly.please help me .Hello Duygu,
restrict the original cost keyfigure with a variable which is based on fiscal period (this will be actual cost). And then create a new keyfigure(copy of original keyfigure) and use same variable but in detail of restriction use -1 for offset( this will be previous). And then define a new formula and subtract actual from previous or opposite)
Sarhan. -
How to calculate the Percent change in a dynamic
hi All,
I'm trying to get the percent increase/change of two dynamic
colums. In my report, the user has a checkbox where he can select two colums to calculate the percent growth.
My DataSet is PilarName, Calification(is a decimal value) and Period (this is a string). I created the Matrix this way:
PilarName [Period]
[PilarName] [Calification]
Which give me these values:
So, now I need to create another column to calculate the percentage change between these two colums. I tried this:
I added a Adjacent column group for Period column and I grouped by the calculated column "ColumnDiff". Add the following expression.
=(SUM(Fields!Calificacion.Value)- Previous(SUM(Fields!Calificacion.Value),"ColumnDiff"))/Previous(SUM(Fields!Calificacion.Value),"ColumnDiff")
After that I get:
I'm getting the sum of the two columns instead.
Any clue about what I'm doing wrong? Please help me, I've been looking for the answer but any solution works for me.
Luis CarlosHi Luis,
According to your description, you have a report with different dynamic columns. Now what you want is show your user percentage growth in your matrix report after your user select two of those columns (I think you may use parameter to achieve your “checkbox”
function). Is my understanding correct?
In Reporting Service, we can’t calculate dynamic columns with our build-in arrogation functions. So we need to add custom code into our report, and call those functions which defined in custom code in our expression. We have tested your scenario in our local
environment. Here are steps and screenshots for your reference.
Go to your Report Properties, add the custom code below into your report:
Dim Shared Num1 As Double
Dim shared Num2 As Double
Public Function GetCalification(Calification as Double,Type as String,Type2 as String)
If Type = Type2 Then
Num1=Calification
Else
Num2=Calification
End If
Return Calification
End Function
Public Function GetPec()
Return (Num2-Num1)/Num1
End function
Create a matrix. Put PilarName into Row field, put Period into Column field. In Data field, put the expression below into the textbox:
=Code.GetCalification(Fields!Calification.Value,Fields!Period.Value,Parameters!Period.Value(0))
In our sample report, we created a parameter (named Period) for selecting two columns. You can replace “Parameters!Period.Value(0)” with your own parameter.
Add an outside column at right (%Growth), put the expression below into the textbox:
=Code.GetPec()
Save and preview. The matrix and result looks like below:
Reference:
Custom Code and Assembly References in Expressions in Report Designer (SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
ORPAS:How the percentages in curve profile and resulting buy periods define
Dear All,
Am new to RPAS Assortment planning application,and I have a query in Assorment planning Maintain Curve Profiles
The percentages which are entered in maintain curve profiles will change in resulting buying periods If the length of the buying period does not match that of the lifecycle curve (with exception to curves 1 and 2), the percentage distribution over weeks is extrapolated and normalized to
100% using the shift and resize logic.
Can anyone explain how this percentage distribution over weeks is extrapolated.Appreciate if any one can give explanation with examples
Regards
KrishGretagMacbeth ProfileMaker can tweak profiles. This program is discontinued,
probably replaced by X-Rite's i1-Profiler.
http://www.northlight-images.co.uk/reviews/profiling/i1_profiler_rgb_print.html
The main purpose of ProfileMaker is not tweaking but constructing of profiles,
based on measured targets for specific inks, specific paper and and specified
rasterization algorithms.
Ink colors, dot gain and Lab values for all printed patches are results of measuring.
For the construction of a profile one can choose:
Rendering Intent, Black generation and Total ink limit.
Black generation is defined by UCR or GCR with different levels of strength.
The gray balance is optimized automatically.
If the gray balance is disturbed, then one doesn't have to adjust the Black generation.
Ideally, different strategies for the Black generation lead to the same visual result,
but a multi-ink black with less CMY is more stable and less prone to illuminant
metamerism.
Epson offers for inkjet B/W prints a special "Advanced Black and White Mode":
http://gerryeskinstudio.com/ABW_sept08_paper/index.html
Obviously there is a very strong GCR Black generation, but still all inks are used.
In ProfileMaker I'm using for B/W a special profile with explicitly very strong GCR,
thus avoiding that Epson's internal strategy bypasses my valid profiles.
Altogether: these commercial programs are not suitable for creating ICC profiles
merely based on abstract data (ink colors, assumed dot gain, theoretical rasterzation
or 'halftoning'), but for creating profiles based on measured data.
Additionally for tweaking already available profiles, but this will lead inevitably to a
disturbed gray balance – my experience.
As time goes by things may have changed – corrections are appreciated.
Best regards --Gernot Hoffmann -
How to calculate Sales percentage difference between selected year and its previous year in a Matrix
Hi,
I'm trying to generate a report using matrix like this
Month
Product PreviousYearSalesAmount SelectedYearSalesAmount %SalesDifference
I can populate year sales amount, but i cant calculate the percentage.
Can Anyone help me please.
Note: Month and Year are passed as parameters.
Thank you.Hi Abhiram,
As per my understanding you can show your fields in matrix.
Only problem is to create the additional column which will have the %SalesDifference value right?
If yes,
Just create one column as shown in below screen,
It will create one column, Name the header of this newly created column as %SalesDifference
In below this header , where you want to show the value for %SalesDifference as
=sum(iif(Fields!year.Value=Parameters!year.Value,(Fields!SalesAmount.Value),-Fields!SalesAmount.Value))/Fields!SalesAmount.Value
Set the property of the column in number as Percentage.
run the report, you will see as below screen.
For your reference I am attaching my RDL code, you can save as .rdl file and run the report (sample Data inside the report only)
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Matrix</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.37in</Height>
<Width>5in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixCorner>
<TablixCornerRows>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox16">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Product</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox16</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCornerCell>
</TablixCornerRow>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox17">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox17</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCornerCell>
</TablixCornerRow>
</TablixCornerRows>
</TablixCorner>
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1.79722in</Width>
</TablixColumn>
<TablixColumn>
<Width>1.76722in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="SalesAmount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!SalesAmount.Value)</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>SalesAmount</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox76">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=sum(iif(Fields!year.Value=Parameters!year.Value,(Fields!SalesAmount.Value),-Fields!SalesAmount.Value))/Fields!SalesAmount.Value</Value>
<Style>
<Format>0.00%</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox76</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="month">
<GroupExpressions>
<GroupExpression>=Fields!month.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!month.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="month1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=MonthName(Fields!month.Value)</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>month1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember>
<Group Name="year">
<GroupExpressions>
<GroupExpression>=Fields!year.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!year.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="year">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!year.Value</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>year</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember />
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixMember>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="Textbox61">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>%SalesDifference</Value>
<Style>
<FontStyle>Normal</FontStyle>
<FontWeight>Bold</FontWeight>
<TextDecoration>None</TextDecoration>
<Color>#000000</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox61</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="Textbox62">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox62</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="Product">
<GroupExpressions>
<GroupExpression>=Fields!Product.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!Product.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>1.38889in</Size>
<CellContents>
<Textbox Name="Product1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Product.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Product1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet1</DataSetName>
<Top>0.38in</Top>
<Left>0.04667in</Left>
<Height>0.75in</Height>
<Width>4.95333in</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>1.20167in</Height>
<Style />
</Body>
<Width>5.1in</Width>
<Page>
<LeftMargin>1in</LeftMargin>
<RightMargin>1in</RightMargin>
<TopMargin>1in</TopMargin>
<BottomMargin>1in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<DataSourceReference>DataSource1</DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>501ee6de-61fb-416f-9a92-011661d01cba</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<QueryParameters>
<QueryParameter Name="@year">
<Value>=Parameters!year.Value</Value>
</QueryParameter>
<QueryParameter Name="@Month">
<Value>=Parameters!Month.Value</Value>
</QueryParameter>
</QueryParameters>
<CommandText>select * from
select 'apple' Product ,1 month ,2014 year,2000 SalesAmount
union
select 'apple' Product ,1 month,2015 year,3000 SalesAmount
union
select 'dell' Product ,1 month,2014 year,3000 SalesAmount
union
select 'dell' Product ,1 month,2015 year,2500 SalesAmount
union
select 'apple' Product ,2 month,2014 year,1500 SalesAmount
union
select 'apple' Product ,2 month,2015 year,3000 SalesAmount
union
select 'dell' Product ,2 month,2014 year,3000 SalesAmount
union
select 'dell' Product ,2 month,2015 year,5500 SalesAmount
)t
where year between @year-1 and @year
and Month=@Month</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<Fields>
<Field Name="Product">
<DataField>Product</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="month">
<DataField>month</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="year">
<DataField>year</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="SalesAmount">
<DataField>SalesAmount</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<ReportParameters>
<ReportParameter Name="year">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>2015</Value>
</Values>
</DefaultValue>
<Prompt>year</Prompt>
</ReportParameter>
<ReportParameter Name="Month">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>1</Value>
</Values>
</DefaultValue>
<Prompt>Month</Prompt>
</ReportParameter>
</ReportParameters>
<Language>en-US</Language>
<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>ee1a8383-6595-42b1-94f2-c68d681c85d3</rd:ReportID>
</Report>
Thanks
Prasad
Mark this as Answer if it helps you to proceed on further. -
Finding out the percentage from 2 different reports
Hello Friends,
I am using OBI 10g. I am trying to divide values from one report which has a total count with another report which has a count with a particular criteria. For example, one report has count of people living in various states and the other report has a count of people who are above 60 years living in those states. Now I want to calculate the percentage. Say 80 people are living in Florida and number of people over 60 years living in Florida is 40, so I have these 2 reports already on my page. I want a 3rd report which gives the % of these two reports ie (40/80)*100 = 50. I want to use this 3rd report on the same page. Please let me know how to accomplish this. Also, let me know if you need any other information.
Thank You.Hello Srini,
Thank You for the reply. Here the report for people over 60 years living in Florida is the result of combination of 6 reports (*using combine with another request*). I am not able to figure out how to pull people over 60 years living in Florida and
people living in Florida in the below formula
FILTER(Fact."# People" USING ( people over 60 years living in Florida))/FILTER(Fact."#People" USING ( people living in Florida))*100.0
It will be helpful if you can advice me in this regard.
Thank You
Maybe you are looking for
-
Unable to view page content in Design View
I cannot see the content of a page made from a template in normal Design view. I am able to see the content in Live View mode, but cannot make changes in that view. I can only make changes in code view. My client would like to make changes to content
-
Just bought z2 cant connect to tv
Ive just picked up a z2 when ever I watch a film im unable to either use screen mirroring or throw function where as my previous phone did... I have an lg smart tv Ive downloaded nearly all video player apps from the play store and non of them work f
-
I have published via iWeb for some time, but after I created a new webpage, I have been unable to publish again. This is the latest error message... ".Mac account credentials validation failed for account "account name." I have tried publishing via w
-
I have an HP P1102w LaserJet printer, which is terrifically fast, and I really like it. I want to print index cards (3x5) on it, though, and it won't cooperate. I'm using Microsoft Word 2003 and Windows 7. I can print cards in portrait mode, but not
-
All of a sudden my Macbook won't close. It just stays open about 1/4 inch. Pressing it the cover (SCREEN) down, doesn't do a thing it just pops back up. How can I fix this? Deanna