Using dimension that contains Liquid in Custom Dimension

Dawid
Participant V

I have a dimension in the view that contains some Liquid. It allows me to parameterise the selection of currency conversion. 

It looks like the following:


parameter: conversion_currency {
type: unquoted
default_value: "1"
allowed_value: {
label: "Euro"
value: "EUR"
}
allowed_value: {
label: "US Dollars"
value: "USD"
}
}

dimension:fx_rate {
type: number
hidden: yes
sql: {% if conversion_currency._parameter_value == "EUR" %}
${TABLE}.fx_rate_eur
{% elsif conversion_currency._parameter_value == "USD" %}
${TABLE}.fx_rate_usd
{% else %}
1
{% endif %} ;;
}

In one of the looks I wanted to use the ${fx_rate} to convert a number that isn’t converted by default in the model. In Custom Dimension definition I entered:

${my_view.amount} / ${my_view.fx_rate}

Imagine my surprise when I saw Liquid in my SQL statement

d6b9c598-a8a1-4b8c-9501-cac3e928b584.png

In the end I decided I was going to add my dimension converted to the model but I thought this was an interesting case

0 0 285
0 REPLIES 0
Top Labels in this Space
Top Solution Authors