_in_query is not working for Dimension when using it in COUNT custom field

I face an issue with _in_query to properly define sql_table_name. It is not working when dimension is used in Custom field. 

Scenario: 
1. I defined sql_table_name for a view with liquid and _in_query
  {% if bonuses_daily.account_id._in_query %}
  `tangome-production.finance.bonuses_daily_account`
  {% else %}
  `tangome-production.finance.bonuses_daily`
  {% endif %} ;;

2. When Account_id field is used in filter or returned in table that is working fine. I see SQL than references proper table bonuses_daily_account
 

3cc01b1f-2ce5-4df4-a983-c626b77e71d4.png
02cb7349-99a9-43a2-b866-335de9958f6f.png



3. When I use dimension menu for Account_ID field (three dots) -> AddCustom Field → Count the resulting SQL references wrong table bonuses_daily. 
 

a61eb3fc-8577-4d5c-9c12-aee82963bcd8.png
c3da16b0-fcbf-461e-b007-8383423df6bd.png
  1. When I create measure in the Model that counts Account ID’s that is also working fine. 
    fb783b55-a178-428d-bec1-01feded47cb1.png



    Question: is it a bug or a feature? Can it be fixed?

    I expect that there is no such issue. This is bad for users as they can make custom field and find themselves looking at errors. 
    I want to focus on modelling and not on explaining users how to use COUNT properly.
    _in_query is wonderful feature, but such a issue ruins the whole idea

4 0 197
0 REPLIES 0
Top Labels in this Space
Top Solution Authors