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: 
Not applicable

percentage in stack chart by cycle group

Hi All,

I have a problem that was in a part solved.

I'm facing an issue with the Stack bar chart where I want to show the % for each stack that is relative to the entire bar

I used this which works quite well with DIM1

Sum(Sales) / Sum(TOTAL <DIM1> Sales)

But I have a cycle group and when I use this :

Sum(Sales) / Sum(TOTAL <GetCurrentField([GroupName])> Sales)  it doesn’t work.

However the function GetCurrentField([GroupName])   is correct and return the current field used.

Please help me.

Thank you

Am’

1 Solution

Accepted Solutions
Not applicable
Author

I did some experiment & I believe TOTAL qualifier did not allow the expressions or may be bug. So just pass the variable or add the expression in $() or add list of fields in the group.

Approach 1:

Sum(Sales) / Sum(TOTAL <$(=GetCurrentField([GroupName]))> Sales)

Approach 2:

vFieldName = GetCurrentField([GroupName]) ;

Sum(Sales) / Sum(TOTAL <$(vFieldName)> Sales)

Approach 3:

Sum(Sales) / Sum(TOTAL <Dim1,Dim2,Dim3> Sales)

View solution in original post

3 Replies
Not applicable
Author

You may be try with variable like below:

vFieldName = GetCurrentField([GroupName]) ;

Sum(Sales) / Sum(TOTAL <$(vFieldName)> Sales)


Other way is use all the Dimensions in the group in side Total like below:


Sum(Sales) / Sum(TOTAL <Dim1,Dim2,Dim3> Sales)

Not applicable
Author

I did some experiment & I believe TOTAL qualifier did not allow the expressions or may be bug. So just pass the variable or add the expression in $() or add list of fields in the group.

Approach 1:

Sum(Sales) / Sum(TOTAL <$(=GetCurrentField([GroupName]))> Sales)

Approach 2:

vFieldName = GetCurrentField([GroupName]) ;

Sum(Sales) / Sum(TOTAL <$(vFieldName)> Sales)

Approach 3:

Sum(Sales) / Sum(TOTAL <Dim1,Dim2,Dim3> Sales)

Not applicable
Author

Thank you !!