Calculations in flex-table-card

I am trying to do a calculation in a column in the flex-table-card.

Here is my code (below).

I am trying to show the cost for the power for running various devices. Today the cost of electricity is .288/kwh. However this changes frequently so I put the current cost in an input_number helper. I would like to change the calculation to multiply the kwh used by the input_number helper- instead of the fixed .288 value. I’ve tried multiple approaches, none of which have worked. Any suggestions?

type: custom:flex-table-card
title: Power Draw Daily
  include: sensor.*[Dd]aily
sort_by: state-
strict: 'true                    '
clickable: 'true                  '
  - data: friendly_name
    name: Device
  - data: state
    name: kWh
  - data: state
    name: cost
    modify: ((x) * .288).toFixed(2)
  1. Suggest you to always select an appropriate section (like “Configuration / Frontend”) - otherwise your post will be not noticed by many people.
  2. There is a dedicated thread for “flex-table-card”. Let’s share our experience in one place.
  3. What I noticed in the code - why these bool values are placed inside quotes?
strict: 'true                    '
clickable: 'true                  '
  1. Answering your question about using “input_number” in calculation. In short - not possible (unless this value is an attribute of this entity).

Thank you!

It does seem for my use cases that using attributes in a template sensor is the best way to go. Things like multiplying the kWh by an input_number and having a total row necessitated this approach. This is still a work in progress - but here is what I have so far:

As for the booleans in quotes - I had started this by copying an example shown in a discussion group. I soon discovered that the quotes had to go - not sure why they were there in the first place.

Great! Suggest you to continue this discussion in the mentioned dedicated thread, this topic may be lost (

Can I just add the correct parameters to this - or do I need to start over to have the discussion show up there?