Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Margaret
Creator II
Creator II

convert rows to columns in script

I want to count up the times that physicians of different specialties opened their e-Newsletter in particular months. I want to do this in the script so that I can later calculate percentages for each month and total percentage.

Here's my source data:


Specialty                         Open

Cardiology                         August

Obstetrics                         August

Ear Nose Throat                 August

Cardiology                         August

Obstetrics                         July

Cardiology                         September

Here is my desired result set:

Specialty              August          July          September

Cardiology             2                      -               - 

Obstetrics             1                       1               -   

Ear Nose Throat    1                       -               1

How can I do that in Script

Thank you!!

4 Replies
Chanty4u
MVP
MVP

create stright or pivot table

dimension:Specality

Exp:count(open)

Kushal_Chawda

Create the Pivot table:

Dimension :

Specialty

Month

Expression:

Count (Specialty)

Now drag the month on expression column

tamilarasu
Champion
Champion

Hi Margaret,

Check the attachment

Capture.PNG.

settu_periasamy
Master III
Master III

Hi,

If you want that in Script level try with Generic Load..

Use cases for Generic Load | Qlikview Cookbook

t1:
LOAD * INLINE [
Specialty, Open
Cardiology, August
Obstetrics, August
Ear Nose Throat, August
Cardiology, August
Obstetrics, July
Cardiology, September
]
;

T1_New:
LOAD Distinct Specialty Resident t1;

temp:
generic LOAD Specialty,Open,Count(Open) as Count Resident t1 Group by Specialty,Open;

DROP Table t1;

FOR i = NoOfTables()-1 to 0 STEP -1
LET vTable=TableName($(i));
IF WildMatch('$(vTable)', 'temp*') THEN
LEFT JOIN (T1_New) LOAD * RESIDENT    [$(vTable)];
DROP TABLE  [$(vTable)];
ENDIF
NEXT i

Capture.JPG