I still haven't found a way to show a contextual a...
# gooddata-platform
h
I still haven't found a way to show a contextual attribute next to a metric... In SQL: I would have written a query select currency, sum(amount) from my_table group by currency; Hence you'd be able to show a consistent Currency next to the Sum Amount. In MAQL I can not do that....
j
Hi I am not sure if I understand where you see the problem. You can create a metric such as:
Copy code
select sum(amount)
and put it into insight together with attribute Currency and the engine will effectively run SQL query like you described and present results in table with sum(amount) per currency. If you need to do grouping per currency in a metric (e.g. to calculate sum amount per currency and then return the biggest amount from all the currencies, you can use BY keyword in MAQL. Example
Copy code
select max(select sum(amount) by currency)
I suppose the โ€œcurrencyโ€ attribute is in the same dataset as amount or there exist oriented path in logical data model from the attribute to fact via relationship edges.
h
Untitled.txt
I can create the metrics, but I cannot show the currencyname. Imagine having a table like above and you want to show the currency sum(amount) and the currency name
How would you do that?
j
you meen in the same table cell?
h
Next to a metric. Happy to take whatever possibility ๐Ÿ™‚ the only options I found until now is fixed formatting my metric. I found no way to show the currency name in relation to the metric...
j
I do not think it is feasible with currently available product features, but there may exist some workaround using MAQL and metric formatting if the number of currencies is low and static.
h
I think indeed it is not possible... Can you explain the workaround please?
j
for example use MAQL to encode currency into the metric like this: 10001000 20000500 30000456 and then use conditional metric formating and display value modulo 1000000
h
I understand ๐Ÿ™‚
That's creative ๐Ÿ™‚
j
the other attributes in report would however need to determine single currency
๐Ÿ™‚
h
They do, but still it's super risky to do this. We have a tens of currencies in our data. Our business is amounts, currencies, conversions. I can't be light about that...
As a workaround can I show an attribute value somewhere else?
j
You may also consider using of custom dashboard plugin and render custom table with reordered columns or merged value with currency.
In edit mode of the table you would see currency and value as separate columns but users of dashboard would see them formatted according to your needs.
h
I will check that out Jakub, thanks for your reply. ๐Ÿ™‚