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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to put both -ve and +ve value in same bar chart

In a column of a table if contains both -ve and +ve value how we can put both -ve and +ve value in bar chart.

31 Replies
shumailh
Creator III
Creator III

reference from the Qlikview Help:

before( [ total ] expression [ , offset [,n ]] )

Returns the value of expression evaluated with a pivot table's dimension values as they appear in the column before the current column within a row segment in the pivot table. This function returns NULL in all chart types except pivot tables.

On the first column of a row segment a NULL value will be returned, as there is no column before this one.

shumailh
Creator III
Creator III

I think, you need to define variance on edit script mode.

Regards,
Shumail Hussain

Not applicable
Author

In a bar chart you might be able to use the Above() function rather tham Before()

EG:

Sum(SalValue) - Above(Sum(SalValue),0,1)

Not applicable
Author

You could probably use the Above() function in a bar chart to do this.

Try something like:

Sum(SalValue) - Above(Sum(SalValue),0,1)

Not applicable
Author

Hello Nigel! I used Above() function it doesn't work either. Please let me know whether there is any alternate for this.

Not applicable
Author

Hello Hussain! Let me know what and how i need to define in edit script mode.

shumailh
Creator III
Creator III

you can use the same function which you are using at the development level. add this field in your script and load


LOAD Year,
Sales,
(Sum(Sales) - before(Sum(Sales))) as Variance
FROM (biff, embedded labels, table is Sheet1$);


Regards
Shumail

shumailh
Creator III
Creator III

Above() function also returns null in all chart type.. reference from the help.

Regards,
Shumail Hussain

Not applicable
Author

Hello Hussain! I have tried your method but it says that BEFORE is not a valid function. Please error message which i got when i loaded script.

Error in expression:
BEFORE is not a valid function

Variance:
LOAD Year,
Sales,
(Sum(Sales) - before(Sum(Sales))) as Variance
FROM stk_sales

shumailh
Creator III
Creator III

This will works,


LOAD Year,
Sales,
Sales - Previous(Sales) as Variance
FROM (biff, embedded labels, table is [Sales$]);


Regards,
Shumail Hussain