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))
Can you try changing your expression to this:
=Sum({<year={$(cy),$(pv)}, qtr =>} sales) / Sum({<year={$(cy),$(pv)}, qtr =>} TOTAL <year,qtr> dkey)
Not sure if it will make any difference, but lets start with making that change and see if it works or not.
Best,
Sunny
Returns same data, but does not resolve coloring issue
If no year filter, all 8 bar stacks are colored appropriate
If 2014 filtered on, 13 & 14 display....but only 2014's bars are colored appropriately.
Give this a shot for color expression:
=Pick(Match(Only({1} Category),'1','2','3','4'),
RGB(84,130,53),RGB(101,156,64),RGB(121,187,76),RGB(145,224,92))
Can you post a qvw?
no year qtr filter I show 8 bars colored correctly
year filtered on shows no data
qtr filtered on shows data appropriatly
I deal with sensitive data, I get real iffy about posting anything online. =\
Have you tried this both your current expression and the new expression I gave you in my first post? i.e with:
1) sum ({$ <year+={$(cy),$(pv)}, qtr+={*}>} sales) / sum ({$ <year+={$(cy),$(pv)}, qtr+={*}>} TOTAL <year,qtr> dkey)
and
2) Sum({<year={$(cy),$(pv)}, qtr =>} sales) / Sum({<year={$(cy),$(pv)}, qtr =>} TOTAL <year,qtr> dkey)
Tried both of those. Data displays correctly
Colors correctly for either data filtered on, or when no filter
Colors correctly for either data filtered on, or when no filter
Not sure I understand what you are trying to say here? Can you please elaborate.
Best,
Sunny