Now, I have a selector and measure as below
However, it shows the number not in percentage.
I found some people discuss using HTML parameter can change the apperarance
here: Dynamic value format name
but I didn`t get how to show them in percentage style using Dynamic value format.
parameter: measure_selector {
label: "parameter(y)"
type: unquoted
allowed_value: {
label: "total amount of conversions"
value: "new_total_conversions"
}
allowed_value: {
label: "total amount of clicks"
value: "total_clicks"
}
}
measure: selected_measure {
type: number
label: "selector(y)"
description:
sql:
{% if measure_selector._parameter_value == "new_total_conversions" %}
${new_total_conversions}
{% elsif measure_selector._parameter_value == "total_clicks" %}
${total_clicks}
}
Now it shouws like this:
0.03
And this is what I want:
3%
Something like this should work (replace ( ) with { }):
html:
(% if count_format._parameter_value == "'percent'" %)
(( value | times: 100 | round: 2 ))%
(% else %)
(( value ))
(% endif %)
;;