21.01.2013 Views

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

27.2 Cross Tables<br />

A cross table is a common type of table featuring a matrix of values between two orthogonal lists of header<br />

data. It could look like the table below.<br />

Example 1:<br />

ex1.csv<br />

Year Jan Feb Mar Apr May Jun<br />

1991 45 65 78 12 78 22<br />

1992 11 23 22 22 45 85<br />

1993 65 56 22 79 12 56<br />

1994 45 24 32 78 55 15<br />

1995 45 56 35 78 68 82<br />

If this table is simply loaded into <strong>QlikView</strong>, the result will be one field for Year and one field for each of<br />

the months. This is generally not what you would like to have. One would probably prefer to have three<br />

fields generated, one for each header category (Year and Month) and one for the data values inside the<br />

matrix.<br />

This can be achieved by adding the crosstable prefix to the load or select statement.<br />

The statement for loading this cross table could be:<br />

crosstable (Month, Sales) load * from ex1.csv;<br />

The result in <strong>QlikView</strong> would be as follows:<br />

The cross table is often preceded by a number of qualifying columns, which should be read in a straightforward<br />

way. This is the case in example 2:<br />

Example 2:<br />

ex2.csv<br />

Salesman Year Jan Feb Mar Apr May Jun<br />

A 1991 45 65 78 12 78 22<br />

A 1992 11 23 22 22 45 85<br />

376

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!