# Build a product usage funnel with Metabase

Learn how to visualise product success in Metabase

Metabase is a great app for learning about and visualising your product data. A mainstay of any product dashboard is the usage funnel - tracking the proportion of users that complete a product journey or goal within your service. Whilst Metabase has a funnel visualisation available, making it work can be a bit tricky - so here is a worked example.

Usage funnels are good for visualising the flow of usage in your app. They work best for linear processes or journeys towards a final goal being complete - e.g. a purchase, a report being generated or anything else which the user (or you) derive value from. The classic usage funnel is presented as a series of stages or steps along the journey, with the height of each step proportional to the number of users visiting or attaining that step in the journey. If your funnel ends with a needle like point, then you’ve got problems as few users are reaching the final step. Ideally, we want a nice fat tube, a pipe of value!

## Example product usage funnel - a timesheet app

For our worked example, let’s imagine we’re product manager for a timesheet app. People use our app to log their time on various projects, and then at the end of the week submit for approval to their manager. What fun.

For our analytical delight, we have an ‘events’ table in our usage datatbase which logs each time a key event happens in our service. It’s got the following columns:

• id (a unique id)
• datetime (date/time the event happened)
• device (what type of device were they on)

Lots of lovely data there to play with!

## Simple usage reporting

Metabase has a built in query editor which is great for quick and simple analysis. We can quickly look at how many events have been logged for each step of our usage journey over the past month:

Great - it shows us an answer as a table, and the numbers look right. For a funnel chart in Metabase, we need each step to be its own row - so this looks like a good start. However, when you select the funnel visualisation, it looks all messed up!

## Fixing the ordering of steps in a Metabase funnel

So this is where it gets a little annoying - the steps are ordered alphabetically. You probably can’t change the data in the database, so to fix we have to resort to a more complex query using the SQL editor:

select
count(distinct id),
case
when event = 'Track time' Then 'C - Track time'
when event = 'Submit timesheet' Then 'D - Submit timesheet'
end as step
from events
where datetime >  current_date() - interval 1 month
group by event
order by case
when event = 'Track time' Then 'C - Track time'
when event = 'Submit timesheet' Then 'D - Submit timesheet'
end


What this does is uses a case statement to ensure the step names come out in an alphabetically corrected order. Whilst this is a bit of an overhead, if your usage data is logged with an internal name or id, at least this is an opportunity to specify the words you want to appear on your chart!

When we use the funnel visualisation, everything looks great:

Now you can add your funnel to your product usage dashboard along with other charts and stats.

It’s annoying that the steps can’t be re-ordered in the chart options, but it seems like this has been raised as a possible new feature so there is hope that it may be looked at in the future. Until then, the work-around above isn’t too bad.