Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've got a stacked bar chart that I want to display, by quarter, sales for the past 2 years.
The issue I have is, coloring applies correctly to only the Year & Quarter I have currently filtered on.
How do I edit my coloring expression to fix that? Is it a set analysis issue?
variables set,
cy = max(year)
pv = max(year)-1
Dimensions:
=right(year,2)&'-Q'&qtr
=1 ---- >I have to add this obligatory dimension to make it a stacked bar, rather than a side by side bar
=category
Expression:
sum ({$ <year+={$(cy),$(pv)}, qtr+={*}>} sales) / sum ({$ <year+={$(cy),$(pv)}, qtr+={*}>} TOTAL <year,qtr> dkey)
Bar chart Color Expression:
pick( match(category,'1','2','3','4'),
RGB(84,130,53),RGB(101,156,64),RGB(121,187,76),RGB(145,224,92))
Using both of your codes,
the bar graphs display appropriately no matter what year/qtr is filtered on.
the bar graphs color as I want, when no filter is applied
When a year or qtr filter is applied, only those bars on the graph color correctly, all other bars revert to default color scheme of qlik
So basically adding Only({1} to your color expression did nothing. Everything still stays the same. I am not sure what could be going wrong here. I know you don't want to share your application, but you might want to share a sample of hide sensitive information and then share your application.
Sunny
We all deal with sensitive data See: Preparing examples for Upload - Reduction and Data Scrambling
Another alternative is to prepare a small example with dummy data that recreates your problem.
-Rob