Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've looked across the forum from back in 2017 regarding the issue of a dimension coloring not being available when you switch to an alternative dimension? Is that still the case?
I'm running into the same issue where I currently color by dimension for my 1st dimension.
When I switch to my alternative dimension (2nd dimension), it completely disregards the master dimension I created with color values and becomes gray.
Anyone have any insight if this bug still exist or a workaround for this simple problem?
Thank you all.
Using expressions for coloring can indeed cause the legend to drop. you can try #2 and #3 methond along with that here are some additional solutions to maintain color coding and display the legend that you can try
1. Create a drill-down dimension that includes both your primary and alternative dimensions. This way, the chart will automatically adjust the legend based on the selected dimension.
Example: DrillDownGroup:
LOAD * INLINE [
Dimension
'Primary Dimension'
'Alternative Dimension'
];
Use this drill-down dimension in your chart.
2. To retain the legend while using expression-based coloring, ensure that the expression includes all possible values for both dimensions.
Example: if(Dimension='Value1', rgb(255,0,0), if(Dimension='Value2', rgb(0,255,0), if(Dimension='Value3', rgb(0,0,255), rgb(128,128,128))))
I think the issue of alternative dimension colors not being retained when switching dimensions still exists. However, there are a few workarounds you can try:
1. Use Conditional Coloring: Instead of relying on master dimensions, use conditional expressions to set colors based on the dimension values.
Example: If(Dimension = 'Value1', Red(),
If(Dimension = 'Value2', Blue(),
If(Dimension = 'Value3', Green(), Gray())))
2. Set Colors in the Script: Define a color mapping table in your load script and use it to assign colors dynamically.
Example:
ColorMaping:
Mapping Load * Inline [
Dimension, Color
Value1, Red()
Value2, Blue()
Value3, Green()
];
Data:
Load *,
ApplyMap('ColorMap', Dimension, Gray()) as DimensionColor
From yourdatasource;
3. Use Master Items with Color Expressions: Create master items with specific color expressions and use these master items in your visualizations.
Example: Create a master dimension with a color expression for each possible value.
4. Custom Theme: you can create a custom theme in Qlik that defines the colors for your dimensions. This can be more complex but offers greater control over the appearance.
Example: Define a JSON theme file with specific color settings for your dimensions.
These methods can help maintain consistent coloring when switching between alternative dimensions.
I hope this helps.
Thank you for your message. I did the above for your #1 to color by expression, but then it will now drop the legend. Seems like an issue I hope Qlik can resolve. Planning to try your other methods but feel that I will still run into the same issue
If you have any other documentation or ideas on how to color code an alternative dimension, but also display the legend, that would be greatly appreciated.
Using expressions for coloring can indeed cause the legend to drop. you can try #2 and #3 methond along with that here are some additional solutions to maintain color coding and display the legend that you can try
1. Create a drill-down dimension that includes both your primary and alternative dimensions. This way, the chart will automatically adjust the legend based on the selected dimension.
Example: DrillDownGroup:
LOAD * INLINE [
Dimension
'Primary Dimension'
'Alternative Dimension'
];
Use this drill-down dimension in your chart.
2. To retain the legend while using expression-based coloring, ensure that the expression includes all possible values for both dimensions.
Example: if(Dimension='Value1', rgb(255,0,0), if(Dimension='Value2', rgb(0,255,0), if(Dimension='Value3', rgb(0,0,255), rgb(128,128,128))))