hi GD team! i’m wondering if it’s possible to assi...
# gooddata-platform
m
hi GD team! i’m wondering if it’s possible to assign a currency symbol to a headline/kpi widget based on a filter applied? i found this doc explaining how to create custom format but i guess it’s not exactly what i’m looking for. for my example
costs
is a fact/metric and
currency
is a dimension that is directly dependent on
id
(filter here). maybe you can advise any approach? i see it somehow as a metric where currency is a variable but i guess it’s not possible since metrics concept only returns numeric values, right? thanks much in advance!
j
Hi, the platform does not have feature which would let you apply different formats based on currency captured in some attribute. You can probably use following workaround: 1. Use MAQL to mix value of metric with identifier of currency into single number (e.g.
1123
for 123 USD and
2123
for 123 EUR. CASE WHEN statement in MAQL can probably help with such transformation (
SELECT CASE WHEN Currency=USD THEN 1000+sum(value), WHEN Currency=EUR THEN 2000+sum(value) END BY Currency
) 2. You can use conditional formatting:
Copy code
[>=2000]€{{{|1000.|0.##}}};
[>=1000]${{{|1000.|0.##}}};
0.##
Obviously you would have to use probably higher number digits for the “currency identifier” because this example lets you display only values smaller than 1000.
this workaround will work only for tables, headlines and KPIs. The “currency identifier” mixed into actual metric value would spoil the charts.
but it probably does not make sense to plot data in different currencies in chart without conversion to a single currency
m
i guess i got the concept, will try to adapt it, thanks much!