Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear QlikSense-Community,
I have a question concerning creating a bar chart which I illustrate with the following example:
The table contains the four programs A, B, C and D. Additionally, the column 'Company' contains a 'Yes' if the program is available for companies, 'Yes' if the program is available for Universities, etc.
Name | Company | University | Private |
Program A | Yes | Yes | Yes |
Program B | Yes | Yes | Yes |
Program C | Yes | No | No |
Program D | Yes | Yes | Yes |
I intend to create a bar chart which contains the number of programs which are available for companies, universities and private.
I would be glad if somebody could help me concerning this issue.
Best,
Oliver
Option 1: Use CrossTable Load:
Table1:
CrossTable (Area, Flag)
LOAD * INLINE [
Name, Company, University, Private
Program A, Yes, Yes, Yes
Program B, Yes, Yes, Yes
Program C, Yes, No, No
Program D, Yes, Yes, Yes
];
Dimension
Area
Expresison:
Count({<Flag = {'Yes'}>}Flag)
Option2:
Table1:
LOAD * INLINE [
Name, Company, University, Private
Program A, Yes, Yes, Yes
Program B, Yes, Yes, Yes
Program C, Yes, No, No
Program D, Yes, Yes, Yes
];
Dim:
LOAD * INLINE [
Area, Dim
Company, 1
University, 2
Private, 3
];
Dimension:
Area
Expression:
Pick(Dim,
Count({<Company = {'Yes'}>}Company),
Count({<University = {'Yes'}>}University),
Count({<Private = {'Yes'}>}Private))
Hey Sunny, thanks a lot for your help!
I just realized that I have to create a pie instead of a bar chart. But I think that does not change the code right?
Additionally, I am relatively new to QlikSense. I have a table with a lot of entries, what do I have to replace in the following code so that it automatically uses the entries that I have in my excel file? (I am referring to Option 2 because it seems easier to me)
Table1:
LOAD * INLINE [
Name, Company, University, Private
Program A, Yes, Yes, Yes
Program B, Yes, Yes, Yes
Program C, Yes, No, No
Program D, Yes, Yes, Yes
];
And in which field do I enter this code:
LOAD * INLINE [
Area, Dim
Company, 1
University, 2
Private, 3
];
I am thankful for your help!
Best,
Oliver
This below would be replaced by your Excel
Table1:
LOAD * INLINE [
Name, Company, University, Private
Program A, Yes, Yes, Yes
Program B, Yes, Yes, Yes
Program C, Yes, No, No
Program D, Yes, Yes, Yes
];
Use your Excel file....
This below
LOAD * INLINE [
Area, Dim
Company, 1
University, 2
Private, 3
];
Needs to be added anywhere in the Script as a New island table which doesn't get linked to anything else within your application (Make sure you don't have a field called Area or Dim in your application)
Also, don't be scared off the CrossTable Load... It is a very useful function to know. Try reading about it here:
Hey Sunny,
I finally figured it out. Thanks again for your help! After copying it into the script, it is important to load the data again so that it gets updated.
Best,
Olli
Hahahaha yes, I thought it was obvious, but I guess I should have mentioned that
Please marking any helpful responses here to make sure others can benefit when they land on this page for answers
Qlik Community Tip: Marking Replies as Correct or Helpful
Best,
Sunny