Liquid: number_with_delimiter not working

Hi, am new to Looker and I am trying to use liquid for some advanced conditional formating but it seems to me after many attempts and research that `number_with_delimiter` is not working properly. Does anyone have similar experience or any workaround?
I need to change rendered value and apply also thousands separators. I am using this but the delimiters are not showing.
{{ value | number_with_delimiter | divided_by: 1000000 | floor | times: 1 }}

0 4 133
4 REPLIES 4

Hey @lucie_winnova !

Can you explain a little bit more your use case, current values and expected ones and the measure that you are making reference, what format has (screenshots will be helpful)?
I'm asking this in order to give you more accurate answer.

Hi @dsimeonova, thanks for your reaction. My goal is to have one table with overview of multiple metrics that are financial values, % shares, avg price etc. I need to format each row differently based on the value that I have managed almost completely. I enclose the printscreen how it looks like now (I use liquid for "conditional formating"). You can see that first row is showing 881095 but I need it to show 8 810 095 or at least 8,810,095 => numeric format with thousands separators.  That is why I am using "number_with_delimiter" in my liquid but it seems it is not working. Bellow full liquid part.

constant: metric_value_format_liquid {
value: "
{% if value >=1000000 %}

{{ value | divided_by: 1000000 | round: 0 | number_with_delimiter | times: 1 }}

{% elsif value <=-1000000 %}

-{{ value | divided_by: 1000000 | round: 0 | times: -1 | number_with_delimiter }}

{% elsif value >=1000 %}

{{ value | divided_by: 1000000 | round: 3 | times: 1 | number_with_delimiter }}

{% elsif value <=-1000 %}

-{{ value | divided_by: 1000000 | round: 3 | times: -1 | number_with_delimiter }}

{% elsif value <0 %}

-{{ value | divided_by: 1 | round: 2 | times: -100 | number_with_delimiter }} %

{% elsif value >0 %}

{{ value | divided_by: 1 | round: 2 | times: 100 | number_with_delimiter }} %

{% endif %}"

}

Screenshot 2024-02-06 at 12.56.20.png

Hi there! You might like to try {{ rendered_value }} instead of {{ value }}. See here 

Hi @sarah_hussain-1, thanks but I tried this and divided_by did not work after that. 

Top Labels in this Space
Top Solution Authors