Hi all, I have a table of asset data that I want t...
# gd-beginners
m
Hi all, I have a table of asset data that I want to show in GoodData. The (simplified) structure is like this:
Copy code
AssetID     AsssetName    Condition
1           Test asset    5
2           Test two      2
3           Test three    3
4           Test four     4
5           Test five     1
The condition values represent the following attributes: 1 = Very Good 2 = Good 3 = Moderate 4 = Poor 5 = Very Poor Is there an easy way in GoodData to display the text value (e.g. "Very Good") instead of the number value (e.g. "1")? I could import a CSV to the data model that maps the numbers to the text values. Is that the most efficient approach?
b
Hi Mal, Question is if the condition is an attribute or a fact. If it’s a fact, it can be simply done via custom number formatting. But from your description it seems more like it’s attribute. In that case you have several options. Handling it on model level by adding either a mapping table, or a separate label to the original attribute is a valid approach. Another option is to use computed attributes.
actually the computed attribute might not be the solution here, as it needs metric values
m
Thanks Boris. Yes, it's an attribute that I want to use to filter reports, so I don't think the custom number formatting would work. I have attempted to set up a mapping table, and had trouble because I used the same names in two different tables. I should be able to fix that, but it still seems a bit cumbersome (I actually have several 'lookup' fields like this to deal with) I am interested in how a separate label on the original attribute would work. Do you know of any docs that could help guide me with that? Thanks again!
b
but it’s possible to handle it on a metric level… you can create such metric:
Copy code
SELECT CASE 
WHEN Condition IN (1) THEN 1, 
WHEN Condition IN (2) THEN 2, 
WHEN Condition IN (3) THEN 3,
WHEN Condition IN (4) THEN 4,
WHEN Condition IN (5) THEN 5
ELSE 0 END
then as you would use this metric in the insight, you can transform the numerical value to text via conditional number formatting, i.e. like this:
Copy code
[=1]Very Good;
[=2]Good;
[=3]Moderate;
[=4]Poor;
[=5]Very Poor;
N/A
some documentation on labels can be found here: https://help.gooddata.com/doc/growth/en/data-integration/data-modeling-in-gooddata/lo[…]del-components-in-gooddata/attributes-in-logical-data-models In your case, it would mean you’d need to add another column to your source data (could be defined as a simple transformation of the condition column). But I am not sure if this is doable for you.
m
Thanks - yes, it may be easier to adjust the source data. I will look into that.