
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stacked Bar Chart - Can't get the Dual() function to work
Hi,
I've got a problem with getting some customized labels on my bars in a stacked bar chart.
Through reading other posts, i've seen cases where people have used Dual(string,num) to provide a customized label for the bars in the chart.
I have the following options enabled in the chart properties:
- Expressions tab: Values on Data Points
- Number tab: Format = Expression Default
- Presentation tab: Plot Values Inside Segments
What i'm doing is this: i have an expression set up with a dual(value+string, value) and i'm expecting to see the value+string inside each segment.
The expression for the moment is:
=Dual(if(Rev > Budget1, Budget1, Rev) & '(45%)', if(Rev > Budget1, Budget1, Rev))
No matter what i try, i can't get it to display the number and text - it always just displays an unformatted number. I've inserted an image of what i've tried below (with figures blacked out, but you can clearly see if doesn't end in "(45%)" ).
I'm using Qlikview 11 SR 2. What am i doing wrong!?
Any help you guys can provide is most appreciated.
Cheers,
Ben
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've played around a bit, and discovered that with the number formatting it works, but only when i disable my uncharted fields.
I'll try to integrate them in and have giant expressions, and see if that works.
Thanks Fernando.
EDIT: Marking this as correct as the actual cause of the issue was the uncharted expressions in the chart. This is what was causing the extra formatted text to not display. The number formatting fernando suggested doesn't appear to be required (it's working without it).


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to include the number format in the string portion of the dual function like this:
=Dual(num(if(Rev > Budget1, Budget1, Rev), '#,##0.00') & '(45%)', if(Rev > Budget1, Budget1, Rev))
Hope this helps you
Fernando

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Fernando,
I tried including the number formatting, but that didn't make any change unfortunately.
Any other ideas?
Cheers,
Ben

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've played around a bit, and discovered that with the number formatting it works, but only when i disable my uncharted fields.
I'll try to integrate them in and have giant expressions, and see if that works.
Thanks Fernando.
EDIT: Marking this as correct as the actual cause of the issue was the uncharted expressions in the chart. This is what was causing the extra formatted text to not display. The number formatting fernando suggested doesn't appear to be required (it's working without it).


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have the same problem. Reading the previous posts I ask myself: what are uncharted fields?
Kind regards
Christian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was dealing with the same problem. It seems indeed there's some kind of limitation using dual() with a stacked bar chart (maybe other objects too).
I managed to solve the problem following this video:
https://www.google.com/search?client=firefox-b-d&q=butterfly+chart+qlik
Although the chart in the tutorial might not be exactly what one's looking for. I guess the solution will work aswell.
In my case, I had a negative value plotted to the left side of a horizontal bar chart, but I wanted to display the values as positives. The solution was to give up using dual() and plot the actual negative value, then use "custom" as measure format in the first/positive measure: ##.##0,0%;##.##0,0%
Naturally, the formating split with ";" will define how to display negatives and positives values (e.g +##.##0,0;-##.##0,0). In this case, it's formated only as positive, so negative numbers still behave as negative, but is now displayed as positive.
