Histogram setting in Native SQL


I was trying to create a histogram for a ‘Native Query’ in metabase v0.31.2, but I found there is only 1 setting ‘X-axis scale’ that can be set to ‘Histogram’ and no setting for ‘bin size’. As we can only create ‘native query’ for some metadata problem, is there any way to set the bin size in metabase for a ‘Native Query’?


The binning isn’t doing anything clever, it just groups the data using the SQL query. If you do a custom, rather than SQL, question then look at the SQL, you’ll see something like this:

FROM "dbo"."Product"
GROUP BY ((floor((("dbo"."Product"."Price" - 0.0) / 300)) * 300) + 0.0)
ORDER BY ((floor((("dbo"."Product"."Price" - 0.0) / 300)) * 300) + 0.0) ASC

Obviously, when you write you’re own SQL, Metabase has no way to then modify it to create the bins.

Thanks a lot for your reply, guess I have to customize the bins myself.

Or create a view