[SOLVED] Gauge question formatting options keep resetting to default

Hi,

I’ve just recently started using Metabase and created a question that shows a percentage value in a gauge.

My problem is that this question has multiple parameters like startdate and enddate that i can change and as soon as I do any change any of parameters the formatting immedietly resets to the default:

IMAGE: https://imgur.com/a/OnrcFOh
When it first loads everything is fine and it shows the gauge with the formatting I gave it (German number format and a % suffix)

But as the second picture shows any change in the parameters will cause it to reset to the default settings and no longer show it with the formatting I gave it.

I also previously tried directly using the “Percentage” formatting option with values from 0 to 1 but it has the exact same issue. Formatting doesn’t stay with the question.

Am I doing anything wrong or is this some kind of Bug?

Hi @gnikolaus
I’ve tried to reproduce your issue without success.
Which version of Metabase? Which browser and version?
Do you see any errors/warnings in the browser console, when it either works with formatting or not?

I’m running Metabase as a jar in the latest version you can download from the website (0.32.8)

I tested it in the latest versions of Firefox, Safari and Chrome and had the issue in all 3 browsers.
Don’t remember seeing any errors in my console.

I’ll try to see if i can built a small reproducable example in my local environment here at home tomorrow. Otherwise I’ll report back next week when I’m back at work at the dashboard that was giving me that problem.

The strange thing was that once I changed the parameter (start and end dates for my query) i could go back to editing the dashboard and once I set the formatting again the gauge would remember that formatting for those specific parameters. So it seemed to me like it was only saving the formattig for the specific parameters used and not in general. But editing the formatting for thousands of possible parameter combinations for every possible start/end date that can be chosen is of course not really a viable option :wink:

@gnikolaus
What type is the question - Custom Question or Native Query (SQL)? If SQL, can you post your query?

I remember seeing an issue with someone who had setup a question/dashboard in an English browser, and then when other people were watching in a German browser (I think it relates to any non-English language), then it would mess up several thing.
So I just want to make sure that you’re only using German browser - then I’ll test with that too.

Your note about changing the formatting, while some parameters were set also helps with trying to reproduce.

Hi,

yes I am using a german browser or more specifically using the default standard “language settings” for preferred locales:
German (Germany): de_DE
German: de
English (American): en_US
English: en

After your post I also tried to set up and use everything using english as a locale but it didn’t change anything.

I’m using a SQL question with the query:

select count(*) / 
(select count(*) from contract Where 1 
[[AND creation_time >= {{startDate}}]]
[[AND creation_time <= {{endDate}}]]) 
from contract
Where status = "CANCELLED"
[[AND creation_time >= {{startDate}}]]
[[AND creation_time <= {{endDate}}]]

This SQL gets the percentage of all contracts with the status “CANCELLED”.
The Database I am using is mysql and the query returns the correct result with every parameter and has no errors.

creation_time is a datetime column and status a varchar.

Any change in the startDate and endDate Parameters always resets my formatting both in the question view as well as the dashboard view. I also tried creation the question multiple times in different ways.

No matter what I do the formatting just doesn’t seem to be saved with the question and only is saved for the specific input of parameters I was using at the time of formatting.

Edit: The same issue exists when I use progress bar instead of gauge. With every change in parameters it resets back from percentage formatting to the default.

What is even more frustrating is that the default it resets to doesn’t even make use of the default number formatting I set in the metabase server and instead always default back to english/american number format.

@gnikolaus
I’ve been trying to reproduce your issue, but without success.
I’m not sure what’s going on. I’m using German locale (just to see if that could be the cause), and I’m using a slightly modified query to make it fit with Sample Dataset (with two simple Date filters):

SELECT (COUNT(*) / NULLIF((SELECT COUNT(*) FROM `ORDERS` WHERE 1=1 
[[AND DATE(`CREATED_AT`) >= {{startDate}}]]
[[AND DATE(`CREATED_AT`) <= {{endDate}}]]
),0)) AS "Num"
FROM `ORDERS`
WHERE PRODUCT_ID > 20
[[AND DATE(`CREATED_AT`) >= {{startDate}}]]
[[AND DATE(`CREATED_AT`) <= {{endDate}}]]

I then set the Visualization to Gauge and add it to an empty dashboard, and connect the two filters.
Then I change the parameters, and then change the card settings to Percentage text, and remove the filters - it continues to display Percentage text.

I think you need to make a screen recording of the entire process (from creating the query and setting filters, to adding it to the dashboard, and to changing the parameters).

1 Like

@flamber

Thank you for taking your time to help me with my Problem.
With your example query I actually found out where exactly my error is and what is causing the constant resetting:

I did not give my select statement result a fixed alias name as you did with

AS "Num"

Because of that my MySql server was auto-generating the result column name from the query I used which of course changed with whatever parameters where input in the query.
So without any parameters my result column was named:

Count() / (select Count() From easy Contract Where True And 1 = 1 )

and with some parameters is was getting returned as:

Count() / (select Count() From easy Contract Where True And Date(easy Contract.creation Time) Between Cast('2019 06 01t22:00:00.000' As Da Te) And Cast('2019 06 10t22:00:00.000' As Da Te) )

I guess the formatting is somehow saved with a reference to the column names of the result and therefor a constantly changing name will mess with the system.

Anyway, I now know where I went wrong.
Thanks again for your help.

1 Like

@gnikolaus
Great we found the cause!
Yes, the formatting is saved with the column name.