How can I divide the result of 2 cards in a dashboard


I have the SQL program of 2 different cards giving me a result each. I want to create a third card that can bring all the information of the result of dividing the 1st result by the 2nd, is it possible?

1st card)

COUNT (distinct smartlockimei) AS completed
FROM trips_view t inner join users_view u on t.userid =
(enddate_txt >= to_iso(DATE_TRUNC(‘day’,now()) AT TIME ZONE ‘utc’ AT TIME ZONE ‘AMERICA/Sumpa’ ))
AND enddate_txt < to_iso(DATE_TRUNC(‘day’,now()+ INTERVAL ‘1 day’) AT TIME ZONE ‘utc’ AT TIME ZONE ‘AMERICA/Sumpa’ )
AND t.viculotype = {{viculo}}
AND t.status = ‘ENDED’
AND t.receipt_totalamount > 0
AND t.receipt_duration > 1 * 60
AND t.receipt_duration < 4 * 60 * 60
AND right(, 10) != ‘
AND right(, 12) != ‘
AND city_id = {{city_id}}

2nd card)

count (distinct as rua
from tusks
JOIN bakas ON = tusks.baka_id
where Tusks.tusk_type_id = ‘10’
[[AND bakas.city_id = {{city_id}}::text]]
AND date(tusks.created_at at time zone ‘Utc’ at time zone ‘America/Sumpa’) = date(now())
AND bakas.viculo_type = ‘Ebaka’
AND result @> ‘{“destination”: “strut”}’

How would be this 3rd card?


Hi @henrique836
Metabase currently doesn’t have a feature like that. You would have to either create a single query, where you divide the two sub-queries, or create a View and do the same.