Condtional format over attribute

Hello everyone,

this is my first post on this forum and I have the following quesiton: is it possible to apply a condtional format based on an attribute?

My use case is the following, I have a view with KPIs in the rows. They have different condtional formats, for instance:
Measure | condition
Market share | positive only, between 0 and 1
Units | positive only
Price | positive only

like here:
“Units”: [
“condition”: “<”,
“value”: “0”,
“className”: “bg-red-100”

But this format should apply to every Kpis which have a particular attribute value

thanks in advance!


You can first show the attribute in the view as a column using a sub-view.
Then use conditional formatting based on another column.
This should work.

You can then optionally hide the attribute column.

We used this in a few models.
There may be other solutions/workarounds.


Hello Muhammed,

thanks for your response!

do you have by any chance a code snippet for that ?

I’m not sure how I can put both combined conditions:

this one relying on the attribute column
“dataColumn”: “checkSchema”,
“condition”: “=”,
“value”: “positive only”,
“className”: “kpi-green”
and this one relying on the value of the cell:
“condition”: “<”,
“value”: “0”,
“className”: “bg-red-100”

I do not know if it is possible to apply classes and combine them.
When we had a similar requirement, we created an additional custom class containing both formats of the classes

You can try the option “condition2”, value2" to have a secondary condition.

Below is an example on multiple conditions and one checking the Data Column:

Alternatively, if it has more complex conditions, you could solve this in the Cube as a rule, then just add the result on the View as an extra column, and then simply apply Conditional formatting based on this result in UX.

The rule option suits me well since it can combine the different conditions

thanks to all for your support!

1 Like