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: 
DSDD
Contributor III
Contributor III

How to calculate relative values in stacked bar chart? (by expression)

Dear community,

i am struggling with set analysis syntax. I want to calculate relative values of Order-Number in a weekly bar chart.

Lets say WEEK is my field for week-date and GROUP1 my field for categorical values.

Pleas help me to find the syntax for the order-counts per week, while WEEK and GROUP1 are dimensions?

I thought COUNT(ORDER_NO)/COUNT(TOTAL <WEEK> ORDER_NO)*100 would do, but obviously not.

WEEK is saved in a variable v_time and may by user selection exchanged with MONTH. The same for GRPOUP1. There are several selectable grouping fields in a second variable v_group.

Labels (2)
2 Replies
MayilVahanan

HI @DSDD 

Try like above

COUNT(ORDER_NO)/COUNT(TOTAL <$(v_time)> ORDER_NO)*100

Hope, v_time is exactly same like ur dimension (Field) name.

 

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
DSDD
Contributor III
Contributor III
Author

Hi ,

i tried it like you mentioned, before and it works in the case of a barplot where i select as bar dimension my field GROUP1.

But:

If the two categorical fields GROUP1 and GROUP2 are within a variable v_parameter, which is contained as $(v_parameter) as bar  grouping dimension, then COUNT(ORDER_NO)/COUNT(TOTAL <$(v_time)> ORDER_NO)*100 does not work anymore. Both groupings are ignored and  COUNT(TOTAL <$(v_time)> ORDER_NO) counts all exising orders without any grouping.

Why? And how does the syntax have to be changed?

Thank you very much for your help