PIVOT example
I need to some help to PIVOT my dataset, need to move the description column to individual columns, so I have 1 row for eaach id
below is an example
declare @Pivot table (
S_dates datetime
, id varchar(10)
, code varchar(100)
, description varchar(max))
insert @Pivot select '2014-03-24 00:00:00.000','1580/7','07611819360532','Matrix 90° L-Plate, medium, 2+2 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert @Pivot select '2014-03-24 00:00:00.000','1580/7','07611819362369','Matrix Screw Ø 1.85 mm, self-drilling, length 4 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-24 00:00:00.000','1580/7','07611819362383','Matrix Screw Ø 1.85 mm, self-drilling, length 5 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-24 00:00:00.000','1580/7','07611819362437','Matrix Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','7551/4','07611819362406','Matrix Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','7551/4','07611819362437','Matrix Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','7551/4','07611819377523','Matrix Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','4820/4','07611819360709','Matrix Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','4820/4','07611819362222','Matrix Screw Ø 1.85 mm, self-tapping, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','4820/4','07611819377523','Matrix Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','3738/4','07611819360709','Matrix Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','3738/4','07611819362222','Matrix Screw Ø 1.85 mm, self-tapping, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','3738/4','07611819362406','Matrix Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','3738/4','07611819362437','Matrix Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert @Pivot select '2014-03-21 00:00:00.000','3738/4','07611819377523','Matrix Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','6578/1','07611819360709','Matrix Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert @Pivot select '2014-03-21 00:00:00.000','6578/1','07611819362406','Matrix Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert @Pivot select '2014-03-12 00:00:00.000','7666/1','07611819381100','Drill Bit Ø 1.5 mm with Stop, length 50/6 mm, 2-flute, for J-Latch Coupling, sterile'
select * from @Pivot
Hi,
Please see the Query below hope it helps. Its dynamic with data. I have used Temp Tables instead of table variables. Hope its helps.
Create
table #Pivot (
S_dates
datetime
, id varchar(10)
, code varchar(100)
, description
varchar(max))
insert #Pivot
select '2014-03-24 00:00:00.000','1580/7','07611819360532','Matrix
90° L-Plate, medium, 2+2 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert #Pivot
select '2014-03-24 00:00:00.000','1580/7','07611819362369','Matrix
Screw Ø 1.85 mm, self-drilling, length 4 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-24 00:00:00.000','1580/7','07611819362383','Matrix
Screw Ø 1.85 mm, self-drilling, length 5 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-24 00:00:00.000','1580/7','07611819362437','Matrix
Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','7551/4','07611819362406','Matrix
Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','7551/4','07611819362437','Matrix
Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','7551/4','07611819377523','Matrix
Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','4820/4','07611819360709','Matrix
Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','4820/4','07611819362222','Matrix
Screw Ø 1.85 mm, self-tapping, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','4820/4','07611819377523','Matrix
Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','3738/4','07611819360709','Matrix
Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','3738/4','07611819362222','Matrix
Screw Ø 1.85 mm, self-tapping, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','3738/4','07611819362406','Matrix
Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','3738/4','07611819362437','Matrix
Screw Ø 2.1 mm, self-tapping, length 4 mm, Titanium Alloy (TAN), sterile, pack of 1 unit in Clip'
insert #Pivot
select '2014-03-21 00:00:00.000','3738/4','07611819377523','Matrix
Drill Bit Ø 1.4 mm with Stop, length 44.5/8 mm, for J-Latch Coupling, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','6578/1','07611819360709','Matrix
Anatomic L-Plate, short, 3+3 holes, reversible, thickness 0.8 mm, Pure Titanium, sterile'
insert #Pivot
select '2014-03-21 00:00:00.000','6578/1','07611819362406','Matrix
Screw Ø 1.85 mm, self-drilling, length 6 mm, Titanium Alloy (TAN), sterile, pack of 4 units in Clip'
insert #Pivot
select '2014-03-12 00:00:00.000','7666/1','07611819381100','Drill
Bit Ø 1.5 mm with Stop, length 50/6 mm, 2-flute, for J-Latch Coupling, sterile'
select
* from #Pivot
Declare @SQL
Varchar(max)
, @Var
Varchar(max)
SELECT
@Var=coalesce(@Var+',','')+'['
+ code +']'
FROM
(Select
DISTINCT code from #Pivot)
as A
Select @Var
SET @SQL
= ''
SET @SQL
= '
SELECT id, S_dates,'
+
@Var
+'
FROM
(SELECT *
FROM #Pivot) AS SourceTable PIVOT
MAX(description)
FOR Code IN ('+ @Var
+ ')
) AS PivotTable;'
Exec
(@SQL)
Regards, PS
Similar Messages
-
Hello,
Can anyone help me write a SQL pivot statement using 11G to do the following?:
Table columns
=========
Deliverable
Phase (For simplicity we'll make the total possible Phase values equal 1 to 13)
Delv_IN_Phase_Y_N Char(3) values 'Yes' or 'No'
I want to make a matrix with these 3 columns in the above table (in reality a complex view) :
- Deliverable is first column.
- Next 13 column headers display 1 to 13 (the posiible values contained in the 'Phase' column).
- The matrix values under the 'Phase' Column headers are the Yes/No values held in the Delv_in_Phase column.
Deliverable Phase 1 Phase 2 Phase 3 Phase 4 ......... Phase 13
=========================================================
Product Market Plan Yes No No Yes No
Bid Plan No Yes No ...........................................
Contract Summary ................................................................................
Quality Plan .................................................................................
Thanks for any help in advance.
CarolJust a simple example based on what I could grasp from your table description.
I assume you can't have more than 1 value (either 'yes' or 'no' for a given deliverable in each phase).
Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
Connected as fsitja
SQL> with t as (
2 select 'Product Market Plan' deliverable, 1 phase, 'NO' Delv_IN_Phase_Y_N from dual union all
3 select 'Product Market Plan' deliverable, 2 phase, 'YES' Delv_IN_Phase_Y_N from dual union all
4 select 'Product Market Plan' deliverable, 3 phase, 'YES' Delv_IN_Phase_Y_N from dual union all
5 select 'Bid Plan', 1, 'YES' from dual union all
6 select 'Bid Plan', 2, 'NO' from dual union all
7 select 'Bid Plan', 3, 'NO' from dual union all
8 select 'Contract Summary', 1, 'NO' from dual union all
9 select 'Contract Summary', 2, 'NO' from dual union all
10 select 'Contract Summary', 3, 'YES' from dual union all
11 select 'Quality Plan', 1, 'YES' from dual union all
12 select 'Quality Plan', 2, 'YES' from dual union all
13 select 'Quality Plan', 3, 'NO' from dual)
14 -- END OF SAMPLE DATA
15 SELECT *
16 FROM t
17 PIVOT(MAX(delv_in_phase_y_n) FOR phase IN (1 AS phase_1, 2 AS phase_2, 3 AS phase_3))
18 /
DELIVERABLE PHASE_1 PHASE_2 PHASE_3
Contract Summary NO NO YES
Bid Plan YES NO NO
Product Market Plan NO YES YES
Quality Plan YES YES NO
SQL> You can play around and expand the pivot by adding the whole 13 values inside the "FOR phase IN (val1 as column1, etc)" just thought I'd keep it simple.
=> [Documentation Reference here|http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#CHDCEJJE]
Regards. -
I work in the transportation industry. We haul a lot of product in a given day from a variety of sources. My bosses would like a report that shows the origins in columns with row data containing the date and number of loads hauled based on the destination. We shift from origin to origin on a daily basis, so I will have some origins that only have a couple of days worth of loads and others that will show loads from several weeks in a row.
From everything I can see, I'm going to need to dynamically create a report that first finds all the origins that were hauled from in a given date range, then generates an aggregating report that shows loads on a given day.
Has anyone got an example of something like this they could point me to?
Here's a visual example of what I'm after:
DATE Origin1 Origin2 Origin3 Origin5 Origin8 ...
9/1/2009 10 2 - - -
9/2/2009 12 16 - - -
9/3/2009 - 15 - - 10
9/4/2009 - - 54 - 10
9/5/2009 - 10 - 15 12
...Okay, I've come back to this issue and I had an idea that was starting to work until I ran into some problems with sheer size. From various documentation sources, it looks like the largest variable I can declare is a VARCHAR2(4000). I figured out a way to dynamically build the SQL statement I need in PL/SQL, but my estimates for the amount of space I need are coming up significantly short.
What I did was build a procedure that attempts to tell me how many columns I need, then loops through the columns and starts generating the SQL in pieces. At the end, my intention was to concatenate the SELECT, FROM, WHERE, and ORDER BY clauses together into one query, then execute the query and see my nice (but very wide and huge) report. I counted the characters I'm going to need, and if I handle up to 30 origins, my SELECT statement is going to be 500 characters by itself. Each of the FROM clauses tops 250 characters (x30 columns = >7500 characters). Then I need another 1000 characters for the WHERE clause and only 30 for the ORDER BY clause.
All in all, I'm estimating almost 10,000 characters for the entire statement. Can I use a CLOB for this? Do I need to write to file and call it as I would a script? Just looking for options.
Here's the start I've got so far:
CREATE OR REPLACE PROCEDURE PROC_BWSUM(f NUMBER, dtst DATE, dted DATE)
AS
--Passed in parameters
v_fact NUMBER := f;
v_from_dt DATE := dtst;
v_to_dt DATE := dted;
--query construction variables
qry_col_ct INTEGER := 0;
qry_stn_ct INTEGER := 0;
qry_stn_id NUMBER;
qry_stn_nm VARCHAR2(27);
qry_stn_key NUMBER;
qry_select VARCHAR2(505); -- will accommodate up to 30 stations
qry_from VARCHAR2(4000);
qry_where VARCHAR2(100);
qry_orderby VARCHAR2(100);
cursor c_cols is select j.STATION_ID, s.SHORT_NM, COUNT(j.LOAD_JOB_ID)
from LOAD_RATES r, STATIONS s, TC c, TC_LOAD_JOBS j
where c.TC_ID = j.TC_ID and j.LOAD_RATE_ID = r.LOAD_RATE_ID
and FN_STN_KEY(j.FACTORY_ID, j.STATION_ID) = s.KEY_ID
and j.FACTORY_ID = v_fact and r.ACTIVE = 1
and c.DATE_INDEX between to_date('09/01/2009','MM/DD/YYYY')
and to_date('10/01/2009','MM/DD/YYYY')
group by j.STATION_ID, s.SHORT_NM
having COUNT(j.LOAD_JOB_ID) > 0
order by j.STATION_ID;
--value variables
v_lds NUMBER;
v_tons NUMBER;
begin
htp.p('<table>');
qry_select := 'select base.DAY';
qry_from := ' from (select c.DATE_INDEX as DAY, COUNT(j.LOAD_JOB_ID) as LDS
from TC c, TC_LOAD_JOBS j
where c.TC_ID = j.TC_ID
and c.DATE_INDEX between v_from_dt and v_to_dt
and j.FACTORY_ID = v_fact
group by c.DATE_INDEX) base';
qry_where := '';
qry_orderby := ' order by base.DAY;';
htp.p('<tr>');
select COUNT(r.LOAD_RATE_ID) into qry_col_ct
from LOAD_RATES r where r.FACTORY_ID = v_fact and r.ACTIVE = 1;
open c_cols;
LOOP
FETCH c_cols into qry_stn_id, qry_stn_nm, qry_stn_key;
EXIT WHEN c_cols%NOTFOUND;
qry_stn_ct := qry_stn_ct + 1;
htp.p('<th colspan=2>'||qry_stn_nm||' ('||qry_stn_id||')</th>');
qry_select := qry_select ||', a'||qry_stn_ct||'.LDS, a'||qry_stn_ct||'.TNS';
IF qry_stn_ct = 1 THEN
qry_where := qry_where ||'where base.DAY = a'||qry_stn_ct||'.DAY (+)';
ELSE
qry_where := qry_where ||'and base.DAY = a'||qry_stn_ct||'.DAY (+)';
END IF;
END LOOP;
close c_cols;
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td colspan = '||qry_col_ct*2||'>'||qry_select||'</td>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td colspan = '||qry_col_ct*2||'>'||qry_from||'</td>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td colspan = '||qry_col_ct*2||'>'||qry_where||'</td>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td colspan = '||qry_col_ct*2||'>'||qry_orderby||'</td>');
htp.p('</tr>');
htp.p('</table>');
end;
/ -
Hi All,
I need to pass the condition as sysdate , sysdate -1 in 'for ' in pivot clause in oracle but am geting the error as 'ORA-56901: non-constant expression is not allowed for pivot|unpivot values' . I need to pass condition as sysdate only not any hard code vlaue. is it possible?
create table pivot_eg ( due_dt date);
insert into pivot_eg values ('16-mar-11');
insert into pivot_eg values ('15-mar-11');
insert into pivot_eg values ('14-mar-11');
insert into pivot_eg values ('13-mar-11');
insert into pivot_eg values ('12-mar-11');
select * from pivot_eg
pivot (count(due_dt) for due_dt in (sysdate as dt ,sysdate-1 as dt1))
is it possible i can use sysdate in for or else i shud go for case kinda pivot example? Please help meHi,
Convert the pivot column into fixed values first, like this:
WITH got_days_ago AS
SELECT TRUNC (SYSDATE) - TRUNC (due_dt) AS days_ago
FROM pivot_eg
WHERE due_dt >= TRUNC (SYSDATE) - 1
AND due_dt < TRUNC (SYSDATE) + 1
SELECT *
FROM got_days_agO
PIVOT ( COUNT (*)
FOR days_ago IN ( 0 AS dt
, 1 AS dt1
;The WHERE clause is for efficiency only. Filter out unwanted rows as early as possible.
Sorry, I'm not at an Oracle 11 database now, so I can't test it.
user2639048 wrote:
... create table pivot_eg ( due_dt date);
insert into pivot_eg values ('16-mar-11'); ...Due_dt is a DATE. Trying to insert2 VARCHAR2 values into a DATE column is asking for trouble. Sometimes we get what we ask for,
Insert DATEs into DATE columns, like this
INSERT INTO pivot_eg (due_dt) VALUES (TO_DATE ('16-mar-2011', 'DD-mon-YYYY')); or this:
INSERT INTO pivot_eg (due_dt) VALUES (DATE '2011-03-16'); -
Hello,
I am using Jdeveloper 11g
Can any one provide me some example on using of Pivote table.
ThanksCheck out george.maggessy.com/2010/07/pivot-table.html?m=1
or http://technology.amis.nl/blog/2593/adf-faces-11g-reloading-the-matrix-using-the-pivot-table-component
Timo -
Really working Crosstab / Pivot Report example
try it here:
http://apex.oracle.com/pls/otn/f?p=20819:2
Details:
Create Report - based on PL/SQL ************************************
DECLARE
l_return_value VARCHAR2(32000) DEFAULT NULL;
BEGIN
l_return_value := PK_PIVOT.PivotSQL('SELECT * FROM TESTDATA', 'country,city,product','FDate', 'SUM', 'amount', nvl(:P2_PAGENUMBER,1) );
--:P2_PAGENUMBER - Textbox above the report
RETURN l_return_value;
END;
Create Supporting PACKAGE PK_PIVOT ************************************
create or replace
PACKAGE PK_PIVOT
--AUTHID CURRENT_USER
as
--code based on famous Tom Kyte's books examples
--but not copy-pasted from there
type refcursor is ref cursor;
type array is table of varchar2(30);
type array_varchar2 is table of varchar2(255);
Function PivotSQL (
p_query in varchar2, --query string which returns data you want to make crosstab on
p_rowfields in varchar2, --row fields separated by comma
p_columnfield in varchar2, --one column field
p_function in varchar2,--aggregate function ('SUM','AVG','COUNT','MIN','MAX')
p_functionfield in varchar2 --field for aggregate function
, p_page in number default 1--page from right to left (not all columns can be shown on one page)
) return varchar2; --returns query text for crosstab
example:
SELECT PK_CROSSTAB.PivotSQL('SELECT * FROM scott.emp','empno','job','sum','sal') FROM SYS.DUAL
SELECT deptno
,sum(DECODE(job,'BOSS',sal,null)) as BOSS
,sum(DECODE(job,'FIN',sal,null)) as FIN
,sum(DECODE(job,'HR',sal,null)) as HR
,sum(DECODE(job,'Sales',sal,null)) as Sales
FROM (SELECT * FROM scott.emp)
GROUP BY deptno
ORDER BY deptno
end;
create or replace PACKAGE BODY PK_PIVOT as
Procedure FormatParam (var_data in varchar2, var_type in number, out_decode in out varchar2, out_col in out varchar2);
Function PivotSQL (
p_query in varchar2,--
p_rowfields in varchar2,
p_columnfield in varchar2,
p_function in varchar2,
p_functionfield in varchar2,
p_page in number default 1
) return varchar2
as
l_max_cols number;
l_query long;
l_columnnames array_varchar2 :=array_varchar2();
l_cursor refcursor;
tmp long;
--dbms_sql types:
l_theCursor integer default dbms_sql.open_cursor;--get col types
l_colCnt number default 0;
l_descTbl dbms_sql.desc_tab;
col_num number;
l_columnfieldtype number;
--decode names
o_decode varchar2(50);
o_col varchar2(50);
l_cols_per_page number := 50;
l_begcol number;
l_endcol number;
begin
--check params
IF instr(p_columnfield,',')>0 THEN
raise_application_error (-20001, 'Can use only 1 columnfield');
ELSIF upper(p_function) not in ('SUM','AVG','COUNT','MIN','MAX') THEN
raise_application_error (-20001, 'Can use only standard aggregate functions');
END IF;
/* analyse query */
dbms_sql.parse(l_theCursor, p_query, dbms_sql.native);
/* get described columns for analysed query */
dbms_sql.describe_columns(l_theCursor, l_colCnt, l_descTbl);
/* Tom Kyte:
* Following loop could simply be for j in 1..col_cnt loop.
* Here we are simply illustrating some of the PL/SQL table
* features.
col_num := l_descTbl.first;
loop
exit when (col_num is null);
--find column field type
if l_descTbl(col_num).col_name=upper(p_columnfield) then
l_columnfieldtype:=l_descTbl(col_num).col_type;
--dbms_output.put_line('Col#:'||col_num||' Name:'||l_descTbl(col_num).col_name||' Type:'||l_descTbl(col_num).col_type);
end if;
col_num := l_descTbl.next(col_num);
end loop;
--return 'test ok';
-- figure out the column names we must support for horizontal cross
if (p_columnfield is not null) then
tmp:='SELECT DISTINCT ' || p_columnfield || ' FROM (' || p_query || ') ORDER BY ' || p_columnfield;
-- dbms_output.put_line('columns cursor:'||tmp);
OPEN l_cursor for tmp;
LOOP
l_columnnames.EXTEND;
FETCH l_cursor into l_columnnames(l_columnnames.COUNT);
--dbms_output.put_line('l_columnnames:'||l_columnnames(l_columnnames.COUNT));
EXIT WHEN l_cursor%NOTFOUND;
END LOOP;
CLOSE l_cursor;
-- execute immediate 'SELECT DISTINCT ' || p_columnfield || ' FROM (' || p_query || ')' bulk collect into l_columnnames ;
else
raise_application_error (-20001, 'Cannot figure out max cols');
end if;
-- Now, construct the query that can answer the question for us...
l_query := 'SELECT ' || p_rowfields ;
l_begcol:=l_cols_per_page*(p_page-1)+1;
l_endcol:=l_cols_per_page*p_page;
if l_begcol>l_columnnames.count-1 then
l_begcol := l_columnnames.count-1;
end if;
if l_endcol>l_columnnames.count-1 then
l_endcol := l_columnnames.count-1;
end if;
--for i in 1 .. l_columnnames.count-1 loop
for i in l_begcol..l_endcol loop
FormatParam(l_columnnames(i),l_columnfieldtype, o_decode, o_col);--format params
l_query := l_query || ',' || p_function || '(DECODE(' || p_columnfield || ',' || o_decode || ','|| p_functionfield ||',null)) as "'|| o_col ||'" ' ; --" для строк с пробелами
end loop;
l_query := l_query || ' FROM (' || p_query || ')';
l_query := l_query || ' GROUP BY ' || p_rowfields || ' ORDER BY ' || p_rowfields;
/* close cursor */
dbms_sql.close_cursor(l_theCursor);
return l_query;
EXCEPTION
WHEN OTHERS THEN
/* close cursor */
dbms_sql.close_cursor(l_theCursor);
raise_application_error (-20001,'Error in PivotSQL:' || SQLERRM);
end;
--=========================
Procedure FormatParam (var_data in varchar2, var_type in number, out_decode in out varchar2, out_col in out varchar2)
--format parameter based on its type - for PivotSQL
--get parameter and its type
-- return strings for decode function and column name
/* dbms_sql.describe_columns types:
DATE Type:12
Varchar2 Type:1
Number Type:2
IS
BEGIN
IF var_data is null THEN
out_decode:='NULL';
out_col:='==NULL==';
ELSIF var_type = 1 THEN -- Varchar2
out_decode:=''''||var_data||'''';--add quotes
out_col:=substr(var_data,1,30);
ELSIF var_type = 2 THEN --Number
out_decode:=var_data;--do nothing
out_col:=substr(var_data,1,30);
ELSIF var_type = 12 THEN --DATE
out_decode:='to_date('''||var_data||''')';--format as internal date
out_col:=to_char(to_date(var_data),'YYYY-MM-DD');
ELSE
out_decode:='== UNDEFINED TYPE:'||var_type;
out_col:='== UNDEFINED TYPE';
END IF;
EXCEPTION
WHEN OTHERS THEN
raise_application_error (-20001,'Error in FormatParam:' || SQLERRM);
END;
end;Hi,
Thank you for providing such an excellent piece of code. I have used it and it works like a charm. However I faced a problem today and needed your help.
I am executing this code using the following code :
SELECT PK_PIVOT.PivotSQL('SELECT sfid.bill_date ,cust.customer_name FROM split_file_detail sfd,customer cust,split_file_invoice_details sfid where sfd.CUSTOMER_SYS_ID=cust.CUSTOMER_SYS_ID and sfid.SPLIT_FILE_DETAIL_SYS_ID = sfd.SPLIT_FILE_DETAIL_SYS_ID'
,'cust.customer_name','bill_date','count','cust.customer_name') FROM SYS.DUAL
Now when I do so I get the following error :
ORA -20001 : Error in PivotSQL: ORA-06502 and ORA-06512.
Now I guess the error maybe because:
1. The p_query parameter is huge and the tmp long type is not able to hold the value.
2. bill_date holds 200+ values and the ref_cursor is not able to handle it.
I have tried breaking p_query down to some more bits but I face the problem when I concatenate them back together.
Can you help me please? -
Error while opening central admin link after power pivot uninstall sp 2010?
Error while any link opened in the cental admin
example:http://server:port/_admin/WebApplicationList.aspx
Required permissions cannot be acquired.
ULS log when Config wizard ran
An exception of type System.IO.FileNotFoundException was thrown. Additional exception information: Could not load file or assembly 'Microsoft.AnalysisServices.SharePoint.Integration, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AnalysisServices.SharePoint.Integration, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.AnalysisServices.SharePoint.Integration, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.SharePoint.PostSetupConfiguration.ReflectionHelper.InvokeConstructor(String assemblyQualifiedName, Type[] constructorSignature, Object[] constructorParameters)
at Microsoft.SharePoint.PostSetupConfiguration.TaskCommon.ReflectionHelperInvokeConstructor(String assemblyQualifiedName, Type[] constructorSignature, Object[] constructorParameters, TaskBase task)
the error same as the below article:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/7a06ebc8-ad8f-4b76-bc44-a8171fde6816/absolutely-sick-of-powerpivot-the-product-stinks-failed-to-find-assembly?forum=sqlkjpowerpointforsharepoint
but any of the sollution did not work.
Thanks
Ravi
RaviI have uninstalled power pivot now the central adminlinks are working.
but when i run configuration wizard it pups with error:
Could not load file or assembly 'Microsoft.AnalysisServices.SharePoint.Integration'
Can i delete follwoing key in the registery?
The follwoing article asked to remove the key:
http://social.technet.microsoft.com/Forums/en-US/487f18d4-32cf-4056-a6de-433f69bb7470/configuration-wizard-failed-to-find-assembly
my registry entry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\ServiceProxies\Microsoft.AnalysisServices.Sharepoint.Integration.EngineServiceProxy]
"AssemblyQualifiedName"="Microsoft.AnalysisServices.Sharepoint.Integration.EngineServiceProxy, Microsoft.AnalysisServices.SharePoint.Integration, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
"ServiceProxyName"="MSOLAP$POWERPIVOT"
Ravi -
Can I 'explain' data in a pivot table?
Hi All.
I have a request that has baffled me.
I need a way to use 'text' to describe the results of a report. If I were doing a simple report,
this would be a non-issue. Here are my hurdles:
I have a report that uses a Union via Set Operations (so I'm combining two result sets).
The results are then shown in a pivot table.
Within the pivot table, variances were created using 'New Calculated Item' under measures.
I want to be able to display in a narrative, or some other magical technique, the results of theses calculated items.
Data Example:
<pre>
Date1 Date2 Variance Variance%
Total Sales 10 20 10 50.00
Sales have increased 50% compared with last quarter. (<- desired result)
Today, I can show @1, @2 etc, but it only shows the columns under 'Date 1'.
Any help is greatly appreciated!!
CindyFirst, if you design a report correctly (e.g., accurate and descriptive headers, etc.), you greatly reduce the need for an "explanation of data." It should be intuitive. If it is confusing to understand, the design of the report should be looked at. (Is this report illustrating what the user needs to see? Should I use a graph instead of a table or vice-versa? Am I reporting on the right metrics?)
That being said, it may be helpful at times to have a narrative to give an overall view of what the report displays. For this, you have the Narrative View to explain whatever might make the report more useful to the end-user. For example, you may have them note certain conditions and what that would mean, etc. (Conditional formatting would be great for this, unless you are considering cross-column conditioning in which case conditional formatting doesn't work.*)
But if you are looking for row-by-row explanations where you use the data in the row as part of the "explanation" (as inferred by your inclusion of @1 and @2, etc. in your question), then I think you may be trying to please your end-users a bit too much. Perhaps I have misunderstood you, so I shall end here and wait for your response.
*Until 11g, that is. There are also workarounds... -
Hello,
I have a table with 3 columns, where person_id is unique id.
<person_id> <event_type> <number_events>
1. I need to transform this into a table with <person_id> <event_type1> <event_type2>.... <event_type-n>
And under each column I need to fill the number_events for each event_type for that person_id
2. Next step is to use that table and convert the same into % of number_events under each event_type, as % of total number_events for each id_member
Thanks1. I need to transform this into a table with <person_id> <event_type1> <event_type2>.... <event_type-n>Problem as a SQL projection cannot be of an-unknown-number-of-columns-we-will-figure-it-out-at-run-time. Unless you use some funky PL/SQL coding to create an Advance SQL Data Type that sports a RTTI interface. And this is typically t0o complex for the "normal" PL/SQL developer that almost never use Advance SQL Data Types to create SQL classes, never mind using OCI calls to define PL/SQL methods for RTTI interfaces.
You can of course have a column that is a collection - and a collection can contain any number of elements.
Example:
SQL> -- create a collection type of strings
SQL> create or replace type TStrings as table of varchar2(4000);
2 /
Type created.
SQL>
SQL> col TYPE format a15
SQL> col NAME_LIST format a100
SQL>
SQL> -- now perform a pivot using a collection where
SQL> -- the collection can be 1..n
SQL> select
2 t.object_type as "TYPE",
3 cast( multiset(
4 select object_name from user_objects n where n.object_type = t.object_type
5 )
6 as TStrings
7 ) as "NAME_LIST",
8 count(*) as "TOTAL"
9 from user_objects t
10 group by
11 t.object_type
12 order by 1
13 /
TYPE NAME_LIST TOTAL
FUNCTION TSTRINGS('TESTPIPE', 'TO_TMINOR', 'TO_SUB', 'AUTHENTICATE', 'CHECKSUM', 'FOOPIPE', 'WEBBROWSER', 'PR 19
EVENTDELETE', 'GETSTAT', 'GETHOSTNAME', 'FOOFUNC', 'TOKENISE', 'DYNAMICFUNCTION', 'STATS', 'POP3', '
CALC', 'VPDBPOLICY', 'LISTTONUMBERS', 'TCPPING')
INDEX TSTRINGS('SYS_C0046436', 'SYS_C0046439', 'SYS_IOT_TOP_125320', 'SYS_IOT_TOP_125322', 'SYS_IOT_TOP_12 23
5324', 'SYS_IOT_TOP_125327', 'PK_STUFF', 'SYS_C0055439', 'SYS_C0076868', 'PATIENT_PK', 'SYS_C0055021
', 'INPATIENT_PK', 'SYS_C0055023', 'BED_PK', 'PK_TAB11', 'PK_ROUTERS', 'SYS_C0055202', 'PK_FOO_TAB',
'PK_FOO_UPDATE', 'PK_SERIALISE', 'SYS_C0058353', 'PK_EMP', 'PK_ANYCHART_TEMPLATES')
LIBRARY TSTRINGS('LIBC') 1
LOB TSTRINGS('SYS_LOB0000125313C00031$$', 'SYS_LOB0000153382C00007$$', 'SYS_LOB0000141150C00002$$', 'SYS 6
_LOB0000205530C00001$$', 'SYS_LOB0000197183C00002$$', 'SYS_LOB0000209404C00002$$') -
A better way to Re-Order the Sort in Pivot view ?
Hello,
Question first- Is there a better way to do this?
Background- Have a simple pivot table w/ requirements to put the Status column in order that makes sense to the business not alphabetical.
Example, # of Service Req with Status needs to be listed as Assigned, Accepted, Completed, Closed, Re-assigned.
My solution was to create a column iin table view, use a CASE statement to say when Accepted =1 etc. I then sorted ASC, hid the column in table view and then pivot view I added Status column and hid the new CASE column. I am getting the results I expected but I was wondering if there was a better way to do this?
Thanks- NeallyAs far as the Presentation Layer is concernd (i.e., in Answers) your way is the best I can think of. The only way you can sort a list of values apart from a way the system could automatically determine (e.g., alphabetically, chronologically, numerically, etc.) is to create your own definition. Without human intervention or customized rules, there is no way any system would know that "C" should come before "S" (as in "Assigned" and "Accepted", or that "O" should come before "L" as in "Completed" and "Closed").
Since the system knows how to order numbers (e.g., 1,2,3, etc.), it makes sense to create your "rule" (using your CASE statement) to assign each status level to the appropriate "number" in the sequence.
That's what I would do. The only addition I can add is you could do this in the rpd by adding an "order" column to your LOVs in the table and exposing that as a column in the Presentation Layer. Then you can use that order column as the sort. -
How to pivot using pivot clause of sqlserver 2005 for three values
Dear all
Is it possible to formulate the query using pivote clause of sqlserver 2005.
( Table name is) BridgeHawra
ReportDate, , Pole, DiameterCost,Flag,OuterDiaCost
01 jan 2014, ,1 , 4.5 ,yes,6
01 jan 2014, ,2 , 4.5 ,no,6
01 jan 2014, ,3 , 5.5 ,no,6
02 jan 2014, ,4 , 5.5 ,no,5.9
02 jan 2014, ,5 , 5.5 ,no,6
1)Pole Col will have unique value.
o2)One pole will have one DiameterCost, but n number of DiameterCost can be there.
I have to show a report which should show , count of poles and cost(DiameterCost* pole count of the day of each DiameterCost) for each date and DiameterCost.
as following
DateOfReport , PoleCountofDiameterCost4.5, DiameterCost4.5, PoleCountOfDiameterCost5.5,DiameterCost5.5
01 jan 2014 , 2
,(2*4.5) ,1
,(1*5.5)
02 jan 2014 , 0/null ,0/null
,2
,(2*5.5)
yours sincerelyYes it is possible though you need to use dynamic pivot technique. Dynamic pivot allow you to select/display column names dynamically.
Below example does not use dynamic pivot,
--create table #temp(ReportDate datetime,Pole int, DiameterCost decimal(5,2),Flag varchar(3),OuterDiaCost decimal(5,2))
--insert into #temp values('01 jan 2014',1,4.5,'yes',6)
--insert into #temp values('01 jan 2014',2,4.5,'no',6)
--insert into #temp values('01 jan 2014',3,5.5,'no',6)
--insert into #temp values('02 jan 2014',4,5.5,'no',5.9)
--insert into #temp values('02 jan 2014',5,5.5,'no',6)
;with cte as (
select ReportDate,
DiameterCost * PoleCount as DiameterCost,
PoleCount ,
'PoleCountofDiameterCost'+cast(DiameterCost as varchar) column1,
'DiameterCost'+cast(DiameterCost as varchar) column2
from (
select ReportDate,DiameterCost,Count(Pole) as PoleCount from #temp
group by ReportDate,DiameterCost
) x
),cte1 as (
select * from cte
pivot( max(PoleCount) for column1 in ([PoleCountofDiameterCost4.50],[PoleCountofDiameterCost5.50])
) pvt
pivot( max(DiameterCost) for column2 in ([DiameterCost4.50],[DiameterCost5.50])
) pvt1
select ReportDate,
Max([PoleCountofDiameterCost4.50]) [PoleCountofDiameterCost4.50],
Max([DiameterCost4.50]) [DiameterCost4.50],
Max([PoleCountofDiameterCost5.50]) [PoleCountofDiameterCost5.50],
Max([DiameterCost5.50]) [DiameterCost5.50] from cte1
group by ReportDate
Regards, RSingh -
March's TechNet Wiki Power Pivot Guru Winners announced!!
The results for March'sTechNet
Guru competition have been posted!
http://blogs.technet.com/b/wikininjas/archive/2014/04/17/the-microsoft-technet-guru-awards-march-2014.aspx <- results page!
Congratulations to all our new Gurus for March!
We will be interviewing some of the winners and highlighting their achievements, as the month unfolds.
Below is a summary of the medal winners, the last column being a few of the comments from the judges.
Unfortunately, runners up and their judge feedback comments had to be trimmed from THIS post, to fit into the forum's 60,000 character limit, however the full version is shown in the link above.
Some articles only just missed out, so we may be returning to discuss those too, in future blogs.
BizTalk Technical Guru - March 2014
Tomasso Groenendijk
Using BAM in the ESB Toolkit
Ed Price: "Incredibly valuable and very well written! Great article!"
Mandi Ohlinger: "A custom BAM dashboard - LOVE it! Another great ESB addition to the Wiki."
TGN: "Nice one, I really liked this one, explains how to use the ESB together with BAM, great work and well explained!"
Steef-Jan Wiggers
Windows Azure BizTalk Services: Pulling Messages from a Service Bus Queue
Ed Price: "This is amazingly well written with beautiful images and formatting. Great job!"
TGN: "Azure, Azure, Azure! Nice one Steef-Jan, people are waiting on articles like this. Good job, and thanks for the contribution!"
Mandi Ohlinger: "A very informative How To. Screen shots are very helpful."
boatseller
Detecting a Missing Message
Mandi Ohlinger: "GREAT addition to the Wiki and to any user who suspects missing messages. The BizTalk support team can use this orchestration. "
Ed Price: "I love the visuals on the orchestration implementation! Important topic!"
TGN: "Nice article, great to see a solution to detect missing files."
Forefront Identity Manager Technical Guru - March 2014
Eihab Isaac
FIM 2010 R2 BHOLD: Non-BHOLD Approval Process
Ed Price: "Very thorough explanations! Great formatting and colors on the tables and code snippets! And the images are also helpful!"
PG: "Nice article, we need more of these."
Micah Rowland
FIM:How To Use PowerShell to View a Metaverse Object's Connector's Attribututes
Side By Side
PG: "Nice article, nice format. well written"
Ed Price: "Good code snippet and use of code comments. Could use more explanations and maybe breaking the code into sections with more information about each section. Good job!"
Giriraj Singh
FIM:Delete Bulk Expected Rule Entries Using FIM OTB features
Ed Price: "Good procedural steps! It could benefit from more explanations, a grammar pass, and some images. Good article!"
PG: "Short but nice article."
SharePoint 2010 / 2013 Technical Guru - March 2014
Matthew Yarlett
SharePoint: Use PowerShell to find Fields using a Managed Metadata TermSet
Jinchun Chen: "Good article."
Ed Price: "Although this is Matt's shorter article this month, this is an incredibly important topic, and the code is perfect! As Dan says in the comments: "Matthew Yarlett has done it again!! IMHO when it comes to SharePoint powershell
you are second to none." This is a great article!"
Rahul A Shinde
SharePoint 2013: Deploy and apply theme to SharePoint sites with PowerShell
Ed Price: "Fantastic explanations and use of images!"
Matthew Yarlett
SharePoint: Testing Email Alerts in UAT and DEV Environments
Jinchun Chen: "Nice! It can be used for troubleshooting SharePoint Incoming/Outgoing related issues too."
Ed Price: "Wow! This article is astonishingly thorough!"
Small Basic Technical Guru - March 2014
Nonki Takahashi
Small Basic: Centering Text in Graphics Window
RZ: "Clearly written explanation with nice graphics to go with it."
Ed Price: "I love having the three options like this! And the images really bring it to life! The links to the shared programs (with their source code) really help if you want to dig deeper and learn more!"
Nonki Takahashi
Small Basic Known Issue: 23589
- Controls.GetTextBoxText() Returns CR+LF as Newline from Multi-Line Text Box in Local but CR in Remote
RZ: "Bugs are always hard to track down, especially the unknown unknowns :( Good job on hunting it down!"
Ed Price: "This acts as a valuable KB article! Great addition to the troubleshooting library!"
Nonki Takahashi
Small Basic: Expression
RZ: "Good introduction to expressions"
Ed Price: "Short and sweet intro to Expressions. Thanks, Nonki!"
SQL BI and Power BI Technical Guru - March 2014
Michael Amadi
A Practical Example of How to Apply Power Query Data
Transformations on Structured and Unstructured Datasets
NN: "This is a terrific tutorial on Power Pivot with very helpful images. Great article"
Ed Price: "This is a fantastic combination of Power Query and Power Pivot... a valuable contribution!"
SQL Server General and Database Engine Technical Guru - March 2014
chandra sekhar pathivada
managing database backups across all the instances without maintenance plan
Samuel Lester: "Chandra, outstanding contribution and information! Your SSIS package handles many of the shortcomings of Maintenance Plans. MPs were originally created to assist DBAs with the more common administrative
tasks, but as the scale continues to grow across enterprise environments, we're all forced to write our own enhanced versions such as this. Thanks for the addition and please do add to the Gallery if you haven't yet."
Jinchun Chen: "Nice. It is suggested to add error outputs in the package to handler unexpected errors."
NN: "Good article. The SSIS solution can use a bit more explanation. Also See Also section is missing"
DRC: "This is good article, The only this which can be corrected is : ==> This can be achieved using “maintenance Cleanup Task • Maintenance Plan has a control flow item “maintenance Cleanup Task” to delete the old backup files based
on age of the backup, but it creates the problem when it deletes the full database backups based on n no.of days leaving all the dependent intermediate differential and transaction logs which are useless. "
Shanky
Understanding Logging in Tempdb.Is Tempdb re-created or rebuilt after SQL
Server restart
NN: "Very good article with an interesting analysis"
DRC: "This article is good and provides lots of detailed information along with sample query and screenshot. The screenshot of few need few more details (files of model are missing) This article can be broken down into 2 1) understanding
tempdb recreation 2) Logging in Tempdb 1) understanding tempdb recreation:- This is not concluded properly. The article doesnt talk about the physical files which are recreated even if we delete the tempdb files "
Samuel Lester: "Shanky, very nice article on the internals of TempDB! It was tough judging this month as both articles were very informative contributions!"
System Center Technical Guru - March 2014
Mr X
How to manage VM pinning within a Hyper-V cluster by
combining the use of System Center VMM and Orchestrator
Ed Price: "Mr. X, this is another incredibly thorough article! Fantastic job!"
Idan Vexler
Create Custom XML For OSD In SCCM
Ed Price: "Love the list of requirements! Very thorough in dividing each step!"
Omar Lopez (loplim)
SCOM 2012 - Create Alert / Monitor Based on Windows event ( Administrator login
alert )
Ed Price: "Good use of images. Could use a TOC with sections and more descriptions. Good job!"
Transact-SQL Technical Guru - March 2014
Jayakumaur (JK)
Understanding IDENTITY in SQL Server
Ed Price: "Wow, what a competitive month! This article is amazing, with thorough explanations in each section!"
Richard Mueller: "A good tutorial on an important feature of T-SQL."
Durval Ramos
Paging a Query with SQL Server
Ed Price: "Durval's article is fantastically thorough and easy to follow!"
Richard Mueller: "Very useful concept when populating controls from a query, which should improve performance. I like the images. Well done."
Naomi N
T-SQL: Split String with a Twist
Richard Mueller: "Very intersting problem with an original solution."
Ed Price: "A very powerful and well-articulated solution from Naomi!"
Visual Basic Technical Guru - March 2014
The Thinker
Exporting and Importing Wireless Settings Using Netsh in VB.NET
SB: "Code could be formatted better, task is something I can see as potentially useful although I would prefer a bit more narrative description and comments in the code explaining why it was done a certain
way, although the code is simple enough to work through."
MR: "Great tool code!"
Ed Price: "This is a good contribution! One way to improve an article like this is to explain the parts of the code more in depth, as a way to introduce each snippet (and maybe dividing a block up more). Then you could link to the Gallery
iteam if the reader wants to access the entire snippet at once. The images are also very helpful! Great job!"
Richard Mueller: "Perhaps this code should be in the gallery. There should be more explanation in a Wiki."
Visual C# Technical Guru - March 2014
João Sousa
ASP.NET WebAPI 2 - Stream Windows Azure blobs
NN: "Very nice tutorial and also can be downloaded from the Gallery"
Ed Price: "I love to see this ASP.NET content! Each step is very clear! Great code formatting!"
Raghunathan S
C# Code Compilation at Runtime from C# Windows Forms Application
Ed Price: "Good descriptions and code formatting. It could benefit from a TOC. Great article!"
NN: "This looks like an interesting article, but too short and the code is hard to read in its present format"
Raghunathan S
Creating a Simple logging class with System.Diagnostics namespace in C#
NN: "Good article, but too short"
Ed Price: "This is a pretty good article. It could benefit from a TOC and more descriptions around what the code is doing and why. Good job!"
Wiki and Portals Technical Guru - March 2014
Matthew Yarlett
Wiki: Basic Image Formatting using Pixlr
BL: "This deserves credit as much for the idea as for the actual article - many authors contribute from computers that may not have authoring tools installed and this simple online solution has the potential to iprove
quality a lot."
Richard Mueller: "Excellent explanation of a useful tool for Wiki authors. A "See Also" section would be useful."
PG: "Nice artilce, well done, nice layout. Great!"
NN: "Good article"
Durval Ramos
VBA & VBS Portal
NN: "Very good new portal about VBA. Introduction may be improved a bit"
Richard Mueller: "A great collection of Wiki articles. Excellent use of recommended features in a Wiki article."
PG: "Nice article good start!"
BL: "Another great initial compilation of relevant resources. Would be very interested in seeing how this develop over time."
Mr X
Wiki: System Center Orchestrator Portal
NN: "Good new portal. Missing See Also section with links to other portals"
Richard Mueller: "A good collection of articles. This Portal adds a lot to the TechNet Wiki."
PG: "Nice and neat article? Suggestion to add more references to related articles and platforms on Wiki."
BL: "great initial compilation of SC Orchestrator resources. Hoping this will grow over time as the product has a few other active Wiki contributors."
Windows Phone and Windows Store Apps Technical Guru - March 2014
Isham Mohamed
Pin Windows Phone 8 app to start screen on first launch.
Peter Laker: "A very useful and informative article! Also, Nice use of fonts and images."
Ed Price: "Good explanation, but it could benefit from a TOC and tweaked formatting. Good job!"
Ibraheem Osama Mohamed
Coming from an asp.net background, let’s build our first Windows Store Application
Ed Price: "Great job on the formatting, explanations, and code snippets!"
Peter Laker: "Excellent primer for those moving from asp.net and all beginners."
mcosmin
The Performance Analyzer Paradox
Ed Price: "This is a good philosophical article, but it would be richer with examples and visuals. "
Peter Laker: "Nice story, good reading, very worthy entry and gratefully received!"
Windows Presentation Foundation (WPF) Technical Guru - March 2014
Magnus (MM8)
WPF/MVVM: Handling Changes To Dependency Properties In The View
Ed Price: "Nice, thorough topic with good explanations! Could benefit from code formatting. Great article!"
Peter Laker: "A nice primer on a fundamental aspect of xaml. Great layout, images, descriptions, etc."
dev hedgehog
Trick To Use StaticResource With Path
Peter Laker: "A very useful and commonly pondered subject. Thanks for a great contribution!"
Ed Price: "This is a great solution with good code formatting and code comments!"
Windows Server Technical Guru - March 2014
Mr X
How to manage your DC/DNS servers with dynamic IPs in Windows Azure
JM: "This is an excellent article, however you need to change all instances of the term "on-promise" to "on-premise.""
JH: "really detailed, very complete with scripts added"
Richard Mueller: "This might be the best article I have judged. Code formatting could be improved, but otherwise an outstanding contribution."
Mr X
How to assign a private Static IP to a Windows Azure VM
JH: "excellent, concise, good topic"
Richard Mueller: "Excellent documentation of the use of very new tools to manage IP addresses."
JM: "Another excellent article, thanks much for your contributions!"
Mahdi Tehrani
Customize DST time zone configuration across the forest with GPO
JM: "This is an excellent article, however you need to change all instances of the term "Daylight Time Saving" to "Daylight Savings Time.""
JH: "good info, great illustrations and writing"
Richard Mueller: "Original work for an tricky problem. I think the script should run as a Startup script instead of a Logon script on the clients. A "See Also" section and links would help."
----------------- 8< -------------------
As mentioned above, runners up and their judge feedback were removed from this forum post, to fit into the forum's 60,000 character limit.
A great big thank you to EVERYONE who contributed an article to last month's competition.
Read all about THIS month's competition [usually in a stickied post] at the top of this forum, otherwise there is usually a list of forum links for this month's theme/announcement at the bottom of the submission page below:
http://social.technet.microsoft.com/wiki/contents/articles/23837.technet-guru-contributions-for-april-2014.aspx
Best regards,
Pete Laker
More about the TechNet Guru Awards:
TechNet Guru Competitions
#PEJL
Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to the one and only
TechNet Wiki, for future generations to benefit from! You'll never get archived again!
If you are a member of any user groups, please make sure you list them in the
Microsoft User Groups Portal. Microsoft are trying to help promote your groups, and collating them here is the first step.Congrats to Michael:
SQL BI and Power BI Technical Guru - March 2014
Michael Amadi
A Practical Example of How to Apply Power Query Data
Transformations on Structured and Unstructured Datasets
NN: "This is a terrific tutorial on Power Pivot with very helpful images. Great article"
Ed Price: "This is a fantastic combination of Power Query and Power Pivot... a valuable contribution!"
Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
Hi,
i have a dimension table with month_key having values (201201,201202,201203.......202011,202012) and month name ( Jan 12, feb 12,......NOV 20, Dec 20) and a fact table with columns (month_key ,measure_types, Amount)
My requirement is to create a power pivot report in which when a user select a month from the filter, the report should display the (selected month+18 ) month's data against each type . when JAN 12 is selected ,the jan 2012 +18 = june 2013
, month name should be populated with months till june 2013 only .
i tried creating calculated column"END DATE " in the fact table with dax expression to calculate the 18th monh from the current month as below
month_key END DATE
201201 201306
201202 201307
and thought of filtering the table with month key <= ENDDATE but it is not working as expected. could you please guide me on this ? Is there any time intelligence function that serve the purpose . Iam using excel 2010
..hence could not do any calculation on the report side also. please suggest .
Thanks in advanceDo you need to show the measure calculated for those 18 months as a total on 1 row, or do you need to select a single month and then display on row filters 18 distinct rows?
The first is trivial as driezl has suggested.
The second will require a second calendar table.
I created this example workbook for a coworker who had a similar problem. You will have to use the disconnected table as your filter and pull your related table onto the rows.
Finally, the easiest way to deal with the sort of date arithmetic you need to do is to restructure your date table to have a series of "Sequential" fields. These fields should be the number of units of time since the beginning of your calendar.
For example, consider a calendar starting on January 1, 2010. For January - December 2010, [MonthSequential] = 1, 2, ..., 12. For January - December 2011, [MonthSequential] = 13, 14, ..., 24, and so on, incrementing by 1 for each sequential month in time.
Assuming you have this set up in your date tables (one related to your model - DimDate - and one disconnected - DisconDimDate) your measure would look like this:
18 Month Measure:=
CALCULATE( [Measure]
, FILTER( DimDate
, DimDate[MonthSequential] >= MAX( DisconDimDate[MonthSequential] )
&& DimDate[MonthSequential] <= MAX( DisconDimDate[MonthSequential] ) + 18
Please review this example along with the workbook I have linked above. -
How to show "ALL" Values by default in Page Drop-Down Lists in Pivot Tables
Hi Everyone,
Iam stuck with 1 problem please can any 1 help me if u know the solution.
Here is my problem:
How to show "ALL" Values by default in Page Drop-Down Lists in Oracle BI Pivot Tables?
For example, if you place Region in the pages area, a Region drop-down list allows the user to select a particular region, and see the data for only that region, rather than seeing all the Regions,But by default its not showing "ALL" option in the drop down list ,rather than doing that its showing result for only 1 region by default.
And an other problem with this pages area is, if we palce the multiple attributes in the Pages area in the pivot table, the (Fields)result is showing in vertically, the attributes 1 by 1(Every attribute in a new line) ,rather than showing like that, is there any way to show the results in horizantally?(We want to have it as a seperate drop drown list for every field horizantally not as a concatenated list).Thanks Nikhil. But I am fetching the values from the LOVCache.java.
I am using <af:selectManyChoice>. Is there any way I can use LOVCache.java value for selecting default values instead of hard coding?
I mean to say can I write
unselectedLabel="#{LOVCache.entityTypeSelectionList.anyValue}"
where LOVCache.entityTypeSelectionList is used to populate the drop down box.
Regards,
Aseet -
Dynamically selecting values for filter in power pivot
Hi,
I am creating a power pivot report. I want the values of its filters to be set dynamically based on certain critreria. For Example, if some one changes the Iteration Path then the range of dates should change automatically to Iteration start date -
Itearation End Date.
Is there any way to set filter values based on some calculation.
Any help in this regard will be highly appreciated.
Thanks,
Bhawna.
Bhawna AggarwalCheck out the Event-In-Progress pattern as described here:
http://cwebbbi.wordpress.com/2013/06/13/a-new-events-in-progress-dax-pattern/
basically you need to create a separate measure which to do the specific filtering for you
hth,
gerhard
Gerhard Brueckl
blogging @ http://blog.gbrueckl.at
working @ http://www.pmOne.com
Maybe you are looking for
-
When I tried to create and apple id using my gmail account i found that somebody has already created an apple id using my gmail id. So I gave forgot password option and reset the password of the id. But for resetting the security questions, link is g
-
RE scanned documents ( image instead of PDF)
I would like to know how with Windows 8 or why when I scan a document it comes as an image and not a PDF document directly. I have bought my computer 3 months ago and I set it up myself may be I have not done everything to be done. Thanks
-
Need help with this code in iWeb
Trying to get the following widget code to run in my sons fundraising website. Isn't working. I have tried coping and pasting the following into 'HTML snippet' on iWeb. No joy. Any ideas? Loader Script: <script>(function() { var d = documen
-
My apologies if this question is in the wrong forum. Couldn't find a form category for IDE issues. When I edit the code of one particular project, I do not get the wriggly lines when I type an error. I must have switched off something. When I load
-
Source works fine, EXE gives no memory error
I have finished my program and am now trying to build the exe taht will run on the cliends workstation. The source has been well tested and does not throw any errors when running. Building the exe works fine but when running the exe I get an out of m