Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Avoid Dimension for sum() in stacked bar chart

I am having a stacked bar chart in which I display entities based on sales of current year(Sorted in descending order based on sales value).

Now for those entities the stacked bars consists of percentage change in sales of products in this year compared to that of last year

I will explain above statment with an example


Entity    Product    2018 Sales2017 Sales
A18050
A26050
B19040
B27040
C13080
C24080

Now my Graph will be having entities sorted on the sum of sales of product 1 and 2 for 2018

        B

        A

        C


But the stacked bar in front of these entities will be having % change in sales of product 1 and 2 for each entity for the year 2018 and 2017.

Now what I am trying to do is get the sales of 2018 next to the entity names in bar chart.

For that I wrote an expression

                              sum(Sales)


With this I am able to get sales for B,A,C next to them but they are overlapping.Since sales for product 1 and 2 is shown seperately.

What I get

          B 90,70 overlapped

          A 80,60 overlapped

          C 30,40 overlapped


What I want

         B 160

          A 140

          C 70

I want the sum of sales for product 1 and 2 next to entity.Not the individual sales

I want the total sales and not at dimension level(My chart has dimension as Entity and Product for stacked bar)

I even tried using sum(Total Sales) but that is giving very weird results

Note:2018 is the year selected by user and not a hard-coded year.

Thanks in Advanced for any help

3 Replies
pooja_prabhu_n
Creator III
Creator III

Hi,

refer the attached qvw file.

Hope this helps

prod.PNG

Thanks,

Pooja

Anonymous
Not applicable
Author

Hi,

Thank you for your answer but I am using a personal edition so cant open that file.Can you please post the formula and the settings you have made to graph.

Also I want sum() to be as text on axis.

In your graph it seems to be sum() of the values represented by bars.

My use case is bit different.My stacked bars represent something different ( they represent change as compared to that of last year)  and I want some of the entity as text on axis.

balabhaskarqlik

May be like this:

Dim: Entity, Product

Style - Stacked.

Sum({<Year = {'2018'}>}sales)

OR

Sum({<Year = {'$(=max(Year))'}>}sales)