If I am making a table and I want to filter the en...
# gooddata-cloud
d
If I am making a table and I want to filter the entire filter by a Fact Metric. What is the beset way to do that. Do I need to create a new metric for each column and add that filter?
f
Hi Doug, I’m afraid I don’t quite understand what you’re looking to achieve here. Would you mind explaining in a bit more detail?
d
I am trying to make a table to put on a dashboard. Bigger but similar to this Dimension 1 Dimension 2 Fact 1 Fact 2 Fact 3 I want to filter the entire table by a range in Fact 2 Such as fact 2 = 1 I can not add fact 2 as a filter. How to I make this table by a filter in fact 2
f
Thanks for explaining! In this case, you can filter the Insight by a Metric value in the Analytical Designer. See the instructions in Filter Visualizations by Metric Values. Let me know if that’s what you’re looking for!
d
Ok, got it. However. What if I didn't want fact 2 to appear on the table. Is there still a way?
f
In this case, you would have to add it to the MAQL definition of your main Metric, so that it filters those values behind-the-scenes. It will depend on your Logical Data Model, but it can usually be achieved via the WHERE Clause and the BY Keyword. For example:
SELECT {metric/fact1} BY {attribute} WHERE {metric/fact2} >= <range>
. If you want to have multiple metrics in the table, you’d need to modify them all have the same filter, like you said before.
d
So if I had the below table Dimension 1 Dimension 2 Fact 1 Fact 2 Fact 3 To be clear, I would only need to add to a new metric for Dimension 1 for it to filter the entire table Dimension metric 1 dimension 2 Fact 1 fact 2 fact 3
f
Sorry, what exactly do you mean by “Dimension” and “fact” in this case? Note that in GoodData jargon we use the words “Attribute” for logical objects that are non-measurable (say, an ID or Name) and “Fact” for measurable objects (like a numerical sales value). Facts need to be calculated via Metrics to be usable in visualizations (for example, the AVG of a number). Once a metric is added to a table (it’s gonna be in the Metrics section of the Analytical Designer), whatever other attributes you add will be used to slice it (contextualize it), thus maintaining any filtering on the metric definition. However, once you add more metrics, the definition changes and might become broader. So, if you have Metric1 that filters values based on Fact2, and Metric2 that does not, the table will not apply Metric1's filtering to Metric2. They are calculated separately. The solution here would be to make sure that Metric2 is also being filtered in the same way. Does that make sense? Please let me know if I’m misunderstanding! If so, I’d appreciate a screenshot so I can better visualize your point. 🙂 Thanks!
j
You may consider to map the column with fact value to an attribute and a fact at the same time. You can aggregate the fact and use attribute for filters on dashboard. You can convert fact to attribute if it is used only for filtering. The fact can be used for filtering using MAQL or aggregated into metric.
d
@Jakub Sterba is this in the data model set up?
j
Yes I meant to do it in the data model.
We are considering to make integer facts more interchangeable with attributes in future but I suppose you seek for quick solution which can be applied now already.
You may see some warnings that attribute and fact is mapped to the same column, but it is only warning. You can ignore it.