Custom fields question and views not available with certain fields


#1

Hi,

My name is Raul. I’ve just landed in a new company where they use metabase so please forgive my ignorance :slight_smile:

  • I’m trying to setup some dashboards and found the “custom field” feature. Very useful to have it on the GUI. However, I see that is only available on tables, not questions. Is there any hack here? maybe I need to define the format of the fields (not sure if that’s even possible).
  • I also realised that I cannot apply the Views to any field within a Question. For example, I got a question which has these two fields (among others): Role (integer), Days to activation (Date field, see example here: “0 years 0 mons 0 days 0 hours 2 mins 56 secs”). I’d like to calculate an average of the “Days to activation” field. However, I don’t see the option available. it only allows me to do it with the “Role” field. How’s that? is there any way to “fix” this.

Thanks a lot!!
Raul.


#2

Hi, @raulprivate , sup?

Not sure if I understood all of your points, but I’ll try to answer your questions below:

  • Not sure what exactly you need with the custom field, but you can format the Question results creating them as a query or changing the metadata type of that specific field (only admins can do this). It’s also possible to perform this using native query option as well.
  • If I understand this properly, you only need to calculate AVG(“Days to activation”), am I correct? If yes, in the “Custom Question” view, you only need to select you data source, then change the box with “Raw Data” to “average of…” and select the field you need.

Hope it helps.


#3

Hi @lucasloami,

Thanks a lot for the quick reply!

  • I think I got my answer with what you said by let me rephrase it (with screenshots! :slight_smile:) . I indeed saw that custom fields can be created within the SQL query but I was just wondering if it was possible to do it by using the interface. I was only seeing that option available when making a question on top of a table (as data source). When doing the question on top another Raw query, the “custom field” wasn’t available. See screenshot here: https://www.screencast.com/t/kEaUrwrt5

  • Yes, that’s correct. However, the data source I’m using is a raw query hence “Custom Expression” is not available. See screenshot here: https://www.screencast.com/t/M0aE7YUjmnp8
    Is there a way to have it there? or this is the expected behaviour

My apologies if my questions sounds very obvious/silly :slight_smile:

Thanks!
Raul.


#4

@raulprivate no worries, man, every question is welcome to me.

In your second point: why don’t you use the 4th item (“average of…”) in the “View” dropdown? About the “Custom Expression” option, I was not able to replicate this error in my computer. Which version of Metabase are you using? Maybe @maz can help you as well in this point.


#5

@lucasloami, I’m using v0.28.3.
The problem is that "Average of " (or any arithmetic function) is not available for that field, only for the “Role” field which is a simple integer. It seems that doesn’t work with that date format: https://www.screencast.com/t/XIfv7fsR4NC
Thanks again!


#6

@lucasloami
I’ve just got admin rights. I think that maybe the lack of functions for specific fields was coming for a wrong definition of the field in metabase. Now that I’m admin I can change the field types. I also can create metrics and segments. This will make my life much easier for sure
Thank!