Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
mike_spada
Contributor III
Contributor III

Relative values on stacked bar chart

Hi,

I'm struggling with this problem: I have a stacked bar chart with Year (Stack) and Class (Bar) as dimensions and an expression like this to count deliveries Count(distinct [Deliveries]). It works. Every stack is colored in a specific way (field called Color).

I'm trying to have the same bar chart but I need % values. I tried with this expression Count(Deliveries) / Count(TOTAL <Year> Deliveries) but it doesn't works: I have every stack on value "1". the wierd thing is that if I create a table with that expression... I have the correct % values!

mike_spada_1-1740743448521.png

The question is... why?? And... how can I solve it?

Thank you in advance.

Mike.

 

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

It should be working - you may check various settings especially the ones how the dimensions are defined because yours shows Year and Class on the bottom ...

marcus_sommer_0-1740745599617.png

 

View solution in original post

3 Replies
marcus_sommer

It should be working - you may check various settings especially the ones how the dimensions are defined because yours shows Year and Class on the bottom ...

marcus_sommer_0-1740745599617.png

 

mike_spada
Contributor III
Contributor III
Author

Thank you Marcus, I noticed that the dimension that I identified with "Class" was calculated as "=If(Year<Year(Today()), Class)", if I replace it simply with "Class" it works.

Have you any idea if I wish to keep that formula on dimension?

Thank you 

M.

 

 

marcus_sommer

You could try to include the condition within the expression, like:

Count({< Year = {"<$(=year(today()))"}>} Deliveries)