Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

maxim1500
Contributor

Sense : Color expression not respecting set analysis

I am trying to apply a color expression based on a value stored in my fact table on a bar chart. Since the fact table contains historical data, I applied a filter to get only current data.

Dimension: FactTableName.SegmentName

Measure: Sum({$<FactTableName.IsCurrent = {"true"}>}[FactTableName.TotalValue])

Everything is working so far. If I filter on a single entity, I get a single bar for his latest segment name.

But if I try to add a color expression like this:

if([FactTableName.SegmentID]=1,rgb(0,51,102),if([FactTableName.SegmentID]=2,rgb(51,51,255),if([FactTableName.SegmentID]=3,rgb(0,153,153))))

A second bar appears with a zero value (bar not visible but segment name appears on the axis) for the entity's previous segmentation.

I get the same issue with treemaps, scatter plots, etc.

Any idea on how to fix this? Color expression should not have an impact on data presentation other than setting the color...

1 Solution

Accepted Solutions
paul_scotchford
Valued Contributor

Re: Sense : Color expression not respecting set analysis

Correct it should not affect the data preso, but I noticed in your IF there is no final colour outcome (Else) , I have added an rgb to the last else in you IF construct, see below, see how you go

if([FactTableName.SegmentID]=1,rgb(0,51,102),

if([FactTableName.SegmentID]=2,rgb(51,51,255),

if([FactTableName.SegmentID]=3,rgb(0,153,153),rgb(255,250,230)

)))

Best regards

Paul

2 Replies
paul_scotchford
Valued Contributor

Re: Sense : Color expression not respecting set analysis

Correct it should not affect the data preso, but I noticed in your IF there is no final colour outcome (Else) , I have added an rgb to the last else in you IF construct, see below, see how you go

if([FactTableName.SegmentID]=1,rgb(0,51,102),

if([FactTableName.SegmentID]=2,rgb(51,51,255),

if([FactTableName.SegmentID]=3,rgb(0,153,153),rgb(255,250,230)

)))

Best regards

Paul

maxim1500
Contributor

Re: Sense : Color expression not respecting set analysis

Thanks for your support. Indeed, I was missing the else condition. As for my initial issue, it is currently being escalated to the R&D team. Issue QLIK-52432.