Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Transform Table

Hi,

Apologies for the very bad format of this post. Nonetheless, I have been struggling in applying the [Code] and[ /code] trick suggested by Jason in his post.

I have the following table in Excel loaded QV.

QUALIFY*;

UNQUALIFY ElectricalDevicesDateID;

ElectricalDevices:

LOAD

autonumber(UpdatedDate) AS ElectricalDevicesDateID,

UpdatedDate,

PDA,

Blackberry,

Phone,

Laptop

FROM

.. \INFOSEC\InfosecKPIs.xls

(biff, embedded labels, table is Sheet2$);

UNQUALIFY*;

I would like to load the table into QV so that I get to the result below:



UpdatedDate Type Quantity

31/1/2010 Laptop 10

31/1/2010 PDA 3

31/1/2010 Balckberry 1

31/1/2010 Phone 10

28/2/2010 PDA 5

28/2/2010 Phone 7

And so forth and so on.

In other words, I have a crosstab in Excel with fields as Laptop, PDA, Phone and their values in the cells by date.

Any help would be much appreciate.

Andrea



1 Solution

Accepted Solutions
Not applicable
Author

thats an easy way with crosstable .. ;



QUALIFY*;
UNQUALIFY ElectricalDevicesDateID;
crosstable (Type,Quantity,2)LOAD autonumber(UpdatedDate) as ElectricalDevicesDateID,
UpdatedDate,
PDA,
Blackberry,
Phone,
Laptop
FROM
..\INFOSEC\InfosecKPIs.xls
(biff, embedded labels, table is Sheet2$);
UNQUALIFY*;


View solution in original post

5 Replies
Not applicable
Author

Friend, try this:

ElectricalDevices:
LOAD
autonumber(UpdatedDate) AS ElectricalDevicesDateID,
UpdatedDate,
PDA,
Blackberry,
Phone,
Laptop
FROM ..\INFOSEC\InfosecKPIs.xls (biff, embedded labels, table is Sheet2$);


Final:
Load
UpdatedDate,
count(Blackberry) as Quantity,
'Blackberry' as Type
resident ElectricalDevices
group by UpdatedDate;

concatenate
Load
UpdatedDate,
count(PDA) as Quantity,
'PDA' as Type
resident ElectricalDevices
group by UpdatedDate;

concatenate
Load
UpdatedDate,
count(Phone) as Quantity,
'Phone' as Type
resident ElectricalDevices
group by UpdatedDate;

concatenate
Load
UpdatedDate,
count(Laptop) as Quantity,
'Laptop' as Type
resident ElectricalDevices
group by UpdatedDate;



Smile

Regards Luciano

Not applicable
Author

Smile

Not applicable
Author

I have problems with the format of my answer. If you dont understand, send me an email, and I will send you the solution.

Mail: luciano.straface@comafi.com.ar

Regards

Straface Luciano

Not applicable
Author

thats an easy way with crosstable .. ;



QUALIFY*;
UNQUALIFY ElectricalDevicesDateID;
crosstable (Type,Quantity,2)LOAD autonumber(UpdatedDate) as ElectricalDevicesDateID,
UpdatedDate,
PDA,
Blackberry,
Phone,
Laptop
FROM
..\INFOSEC\InfosecKPIs.xls
(biff, embedded labels, table is Sheet2$);
UNQUALIFY*;


Not applicable
Author

Straface,

I have taken into account your answer that I will certainly used in a similar script. Nonetheless, I have found Onder's script more practicle and compaq. Thank you both very much for your support. I hope to be able to reciprocate uin the future.

Andrea