Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm quite new in Qlik Sense and I have trouble representing multiple ordinal variables in a stacked bar chart.
I have data from a survey on the motivations to enter vocational training. The interviewees had to answer on a scale of agreement (strongly disagree, disagree, agree, strongly agree) to several statements about motivation.
Attached, a simplified version of how my database looks like and the stacked bar chart I would like to produce.
How can I do that? Maybe I have to change the way my database is built?
Kind regards,
Catherine
Hi Catherine,
I'd suggest using a mapping to convert your text values to dual values
these allow you to define a field with a text display and an underlying numerical value (useful for sorting!)
For example you may define a mapping table as
MotivMap:
MAPPING LOAD * INLINE [
Motiv, MotivValue
Strongly Disagree, 1
Disagree, 2
Agree, 3
Strongly Agree, 4
];
Then, when loading your data
LOAD
Survey
Dual(Motiv1, ApplyMap('MotivMap', Motiv1)) as Motiv1,
etc, etc..
Hope this helps,
Marcus
hi,
in attachment, you find the app wiht:
script : i use cross table to pivot the table
sheet: an example of bar chart
however, you don't show each value in the graphic like your picture
Bye
Thanks Marcus and jsaintmaxent, both replies are very useful ! Now I have to figure out how to replicate it (Script is quite new for me) and when I'm done, I'll update the post!
Catherine
I managed to replicate it. There is no other way to do this without 'unpivoting' the table (crosstab), right?
Thanks, this mapping function is very useful in general but it does not help me to do the graph. It seems that I have to unpivot (crosstab) my table.
i think,you can try with the function if but it's so long and inefficientand if you have got a new value, you will modify the script