Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am having a stacked bar chart with the following setup:
1 dimension as a value list: (=ValueList('A','B','C')
and a few expressions:
1) if(ValueList('A','B','C') = 'A', SUM({<Type={'Won'}>}SalesA), if(ValueList('A','B','C') = 'B', SUM({<Type={'Won'}>}SalesB), null()))
2) if(ValueList('A','B','C') = 'B', SUM({<Type={'Lost'}>}SalesA), if(ValueList('A','B','C') = 'B', SUM({<Type={'Lost'}>}SalesB), null()))
3) ...
For my second expression only (so the lost sales) I want now to change the color of the bar under certain circumstances but only for the value A from the value list.
.Under background color for expression 'B' I used a expression like:
if(ValueList('A','B','C') = 'B',
if("my specific condition", color1, color2))
This works fine if I comment out the first line of the expression (the value list pick) but then I obviously get the color change for all values in the list.
If I use the expression as stated above then the color will not change and always stay as color1.
So my question is now is it possible to change the background color of a bar in a chart by using a value list in the background color expression?
Thanks for your help.
Best regards
Would you be able to share a sample where we can see the issue?
So I created a little test file now and hope that helps showing my issue.
This is my data I am loading into the Dashboard:
Sales A:
Sales B:
the sample qvw is attached.
What I want to do is pretty much to change the color of the lost bar of Sales B under certain conditions.
Thanks for helping.
Best regards
What exactly are you trying to say here?
if(Type='Lost' > 30,
It seems like an incorrect way to right it, but I am not sure what your condition is to give you suggestions for improvement.
in this case just any random if statement. This was the first thing that came to my mind for the example file.
In my real case the if statement works totally fine as long as I am not adding the if(valuelist...) statement. as soon as the valuelist is added the expression is not working anymore. but without the valuelist both bars for A and B change the color. But I only want bar B to change colors.
Meaning the secold line of my statement in the real case works totally fine. But just the first line the: "if(ValueList('A','B') = 'B'," messes the whole statement up somehow
So I am not totally sure if I can write an if(valuelist...) statement in a background color or if Qlikview just doesnt support that feature.
I used this statement
if(ValueList('A','B') = 'B',
if(SUM({<Type={'Won'}>}SalesB) > 30, argb(255,255,217,47), argb(178,178,36,36)))
To get this
Is this what you want?
Okay so it is possible to use a valuelist expression in the background color.
Thanks for that.
It still doesnt work in my real file though. But I cannot publish that due to confidential data.
But there I have a pretty similar expression: if(valuelist, if(condition, color1, color2)) but it still will not change the color accodring to the condition...
I just really dont understand why my expression works as soon as I comment the if(Valuelist out and just leave the if(condition, color1, color2 part.
Also the same expression works in another chart totally fine for me but there also I am not using the valuelist. So thats why I really think it has to be that valuelist statement that messes up my expression somehow.
Unless I see, it would be difficult to say... one thing that might help is... do you have Aggr() in your condition by any chance? If you do, then try adding Aggr(NODISTINCT .....)
Well the expression I am using is:
if(ValueList('A','B','C')='A',
if(CONF=0 or $(v_Condition_MarketShare)=-1,
$(vColour_Competitor),$(vColour_Orange12)))
In another tab of my dashboard almost the same expression works totally fine
if(CONF=0 or $(v_Condition_MarketShare)=-1,
$(vColour_Competitor),$(vColour_Orange12)))
It is just not working anymore when I add the first line with the value list.
I won't really know without getting a chance to look at this... May be look here to see if this thread can help you address your confidentiality concerns
Preparing examples for Upload - Reduction and Data Scrambling