Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey Everyone!
I'm fairly new to qlikview.
I have a dataset of a class of students. This dataset consists of the grades they scored in different subjects from 0-100. Each subject's marks for every student is stored in an individual columns.
There are 10 subjects. Therefore each student (or row) will have 10 columns containing grades.
I want to create a single visualization (bar chart) with a separate object that i can use as a filter for the subjects. So if I wanted to, i could switch between subject 1, 2 or 10 for all students instead of creating a bar chart for each subject.
How should I go about doing this?
Thanks
I would CrossTable your data. Using CrossTable would take your data that looks like this:
Student | Subject 1 | Subject 2 | Subject 3 | Subject 4 | Subject 5 | Subject 6 | Subject 7 | Subject 8 | Subject 9 | Subject 10 |
---|---|---|---|---|---|---|---|---|---|---|
Jane Smith | 100 | 90 | 80 | 70 | 60 | 50 | 40 | 30 | 20 | 10 |
John Smith | 0 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 |
And make it look like this:
Student | Subject | Score |
---|---|---|
Jane Smith | Subject 1 | 100 |
Jane Smith | Subject 2 | 90 |
Jane Smith | Subject 3 | 80 |
Jane Smith | Subject 4 | 70 |
Jane Smith | Subject 5 | 60 |
Jane Smith | Subject 6 | 50 |
Jane Smith | Subject 7 | 40 |
Jane Smith | Subject 8 | 30 |
Jane Smith | Subject 9 | 20 |
Jane Smith | Subject 10 | 10 |
John Smith | Subject 1 | 0 |
John Smith | Subject 2 | 10 |
John Smith | Subject 3 | 20 |
John Smith | Subject 4 | 30 |
John Smith | Subject 5 | 40 |
John Smith | Subject 6 | 50 |
John Smith | Subject 7 | 60 |
John Smith | Subject 8 | 70 |
John Smith | Subject 9 | 80 |
John Smith | Subject 10 | 90 |
You could then use the "Subject" field for filtering.
The code to do this transformation looks like this:
Data:
CrossTable(Subject, Score, 1)
LOAD * INLINE [
Student, Subject 1, Subject 2, Subject 3, Subject 4, Subject 5, Subject 6, Subject 7, Subject 8, Subject 9, Subject 10
John Smith, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90
Jane Smith, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10
];
If you have more fields than just name, you may need to change the 1 to a higher number.
Thanks Nicole!
I appreciate the effort!
I found out on another thread here that I can add the subjects as expressions in the bar chart, and then use the group option in the expression tab to group the subjects together. This created a cyclic group button on my bar chart which allows me cycle between subjects on the same visualization.
I guess I should've searched more before asking this question!