Multiply column by constant in conditional formatting for data table

I am working on a webapp to monitor occupancy. I wanted to paint a row yellow as a warning when 90% of the max capacity was reached. I have two columns, one for max_capacity and another for current_occupancy.

Am I able to do something like:

style_data_conditional=[
                        {
                            'if': {
                                'filter_query': '{current_occupancy} > {max_people}*0.9',
                            },
                            'backgroundColor': '#f8d7da',
                            'color': '#721c24'
                        },
                    ]

Thanks in advance!

Hi @joaofb

I don’t think it’s possible to do calculations in the filter_query.
One workaround is to create a new (hidden) column with the data you want to compare and use that column in the filter_query.

Thanks for the answer, Ann! It’s a shame that you can’t do these simple operations. Hope it becomes a feature soon. I’ll take a look into the Data Table documentation and try to create this hidden column. Thanks again!