# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
Contributor III

## Background color

Hello community,

I am trying to give a background color to a table graph, however, it does not work when I specify the period that it should consider for said painting. As you can see in the image, I want to paint the highlighted values. It is worth mentioning that each period is a measure and within the data the period is not considered as a column. Can someone tell me how I could solve it?

Regards & thanks

DC

Labels (5)

• ### Visualization

1 Solution

Accepted Solutions
MVP

I'm not sure if it's a typo in the post or in the expression but it needs an additional 'and':

=If([Tiempo.Año]=vMaxAño and [Tiempo.Mes]=1 and [Flag Estacionalidad]=1,RGB(215,215,215))

But if each expression has it's Año and Mes fixed maybe you need:

``If(Only({<[Tiempo.Año]={"\$(vMaxAño)"},[Tiempo.Mes]={"1"}>} [Flag Estacionalidad])=1,RGB(215,215,215))``

Also you can try adding an expression to the table like:

=If([Tiempo.Año]=vMaxAño and [Tiempo.Mes]=1 and [Flag Estacionalidad]=1,1)

So you can check on table rmoving or adding contions to check wich one is failing

And you can add a new table to confirm data, set a table with the 3 dimensions ([Tiempo.Año], [Tiempo.Mes] and [Flag Estacionalidad], and confirm that for max Año and Mes=1 there is only one possible value for [Flag Estacionalidad]

9 Replies
MVP

Hi, the question lacks of need information lke the conditions to set the color or the dimesnions used by the rows.

Supposing the date above are a column dimension the syntax could be something like:

If(Match(HorizontalDimension,Values) and Match(VerticalDimension,Values) and ExpressionValues<=>Value, BackgroundColor())

Contributor III
Author

Hello @rubenmarin , the information that is displayed in the header of the columns is not a dimension, it is made up of a measure and I do not have it in another column either, therefore, I wanted to know how to be able to delimit the period without being specifically in the table.

MVP

Hi @DanCasSan, if the column header it's not a dimension it means tht each column has it's own expression.

In this case you can set an if condition to check if the selected values should affect that column to color (or not) the background

Contributor III
Author

That's right, each column is an expression, but how would you do such a condition?

Thanks,

DC

MVP

How values for periods are selected? and examples of values that can be selected.

Also I will need an example of any of the expressions used in columns

But it will be something like:

If(ColumnDate>=Min(PeriodSelected) and ColumnDate<=Max(PeriodSelected), ColorBackground)

Contributor III
Author

For the period 2022-01 the expression of the column is as follows:

``````If(vCicloPVO>1,
Sum({<[Tiempo.Año]={"\$(vMaxAño)"},[Tiempo.Mes]={"1"},[Versión]={"REAL"},[Negocio.Región]={"NORTE"},
[Negocio.Negocio Comercial]={"CONSUMO MASIVO"},[Cliente.Canal Final]={"TRADICIONAL","OTROS"},[Organización Ventas]={"1510","1560"}>} [Venta TM]),
Sum({<[Tiempo.Año]={"\$(vMaxAño)"},[Tiempo.Mes]={"1"},[Versión]={"PVO"},[Negocio.Región]={"NORTE"},
[Negocio.Negocio Comercial]={"CONSUMO MASIVO"},[Cliente.Canal Final]={"TRADICIONAL","OTROS"},[Organización Ventas]={"1510","1560"}>} [Venta TM])
)``````

The period you display is the name of the column label and for this I use the following expression:

``=vMaxAño&'-01'``

It should be noted that there are no selection filters for that view.

Regards,

DC

MVP

So when you write "it does not work when I specify the period that it should consider for said painting" how do you specify the period? Can you give more details on what is not working?

Contributor III
Author

That's right, when I want to specify a period for each column, it doesn't paint the background anymore.

I have used this expression:

``=If([Flag Estacionalidad]=1,RGB(215,215,215))``

When I add the year and month it no longer paints:

``=If([Tiempo.Año]=vMaxAño and [Tiempo.Mes]=1 [Flag Estacionalidad]=1,RGB(215,215,215))``

Regards,

DC

MVP

I'm not sure if it's a typo in the post or in the expression but it needs an additional 'and':

=If([Tiempo.Año]=vMaxAño and [Tiempo.Mes]=1 and [Flag Estacionalidad]=1,RGB(215,215,215))

But if each expression has it's Año and Mes fixed maybe you need:

``If(Only({<[Tiempo.Año]={"\$(vMaxAño)"},[Tiempo.Mes]={"1"}>} [Flag Estacionalidad])=1,RGB(215,215,215))``

Also you can try adding an expression to the table like:

=If([Tiempo.Año]=vMaxAño and [Tiempo.Mes]=1 and [Flag Estacionalidad]=1,1)

So you can check on table rmoving or adding contions to check wich one is failing

And you can add a new table to confirm data, set a table with the 3 dimensions ([Tiempo.Año], [Tiempo.Mes] and [Flag Estacionalidad], and confirm that for max Año and Mes=1 there is only one possible value for [Flag Estacionalidad]

Tags
Community Browser