Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue in showing the -ve value in the bar chart

Hi All,
I want to show the variance in sales when compared the previous year in bar graph. Expression which i am using the pivot table is (Sum(SalValue) - before(Sum(SalValue))). I want to use the same expression in the bar chart and show variance in sale when compared to the previous year. Only thing which i want is if the variance is in -ve then the bar should be downwards.

In my bar graph used dimensions i have used itemname and year and in the expression i have used (Sum(SalValue) - before(Sum(SalValue))) to calculate the variance.

Please give solution for this problem!

Please find the attached document for reference. Will be thankful to you if you create the bar chart where i can show both the +ve and -ve sales variance in bar chart.

Also look into the post which i posted in this post http://community.qlik.com/forums/p/22461/86173.aspx#86173

8 Replies
Anonymous
Not applicable
Author

The reference manual specifies that the Before() function will return NULL in all chart types except pivot tables so you'll have to use some other kind of approach to present the values you're after.

Not applicable
Author

Hi

I used Above() also but wasn't successful. Let me know if you know any other kind of approach.

Not applicable
Author

Sorry Johannes! I didn't attached the document last time. Have attached it now. Hope you can help me out!

Not applicable
Author

Hi Johannes and All,

Can any one help me out on this? please! Still i couldn't find solution anywhere.

Not applicable
Author

Perhaps you can use the Bar Offset option?

Go to the Expressions tab and click on the plus sign next to the expression.

Select option Bar Offset and enter a formula in the Definition field for the starting point of the bar.In this case the negative value of the expression.

I tried it in your sample, but the chart didn't cooperate. I made a new chart (loosing the Year dimension) and with different expressions (the (Sum(SalValue) - before(Sum(SalValue))) expression didn't show anything). The new chart worked like a charm.

Not applicable
Author

Hi Mark,

Hi Thanks for your help. Can you attach the same document which was working as per you so that it will be understandable for me.

Not applicable
Author

Hi ,

Here is the changed file. I added a new bar chart.

In the new chart I placed an expression with the negative value to make it draw "down" and another that draws "up", but starts at the negative value. Result is the same here.

I actually think you don't need to change anything except the calculation of the Before-statement expression to make it work correctly. Can't you use set analysis instead of the Before statement?

Not applicable
Author

Hi Mark,

Thanks for your help! But that is not what i wanted. I wanted to show the sales value in one bar and then the variance in the another bar for each year. I couldn't understand why there is -ve value in the expression. Could you please explain it.

By the way year is missing in your chart. Could you please add in that?

Is it not easy with this. Can any one suggest better way to show the variance of sales in a graph please.