Menelaos Kotoglou
06/06/2023, 1:39 PMMenelaos Kotoglou
06/06/2023, 1:40 PMFrancisco Antunes
06/06/2023, 1:51 PMMenelaos Kotoglou
06/06/2023, 1:54 PMFrancisco Antunes
06/06/2023, 2:01 PMMenelaos Kotoglou
06/06/2023, 2:35 PMMenelaos Kotoglou
06/06/2023, 3:44 PMSELECT x, COUNT(*) FROM y group by x;
Is that possible to do by direct SQL maybe?Francisco Antunes
06/06/2023, 4:18 PMSELECT COUNT(X) WHERE X = 'value'
But the filtering I proposed earlier would have done the same thing, so I suspect that the metric is a bit more involved than that. Would you mind showing me the specific MAQL metric that you are trying to run?Michal Hauzírek
06/06/2023, 5:07 PMSELECT COUNT(y_ID)
. (or simply drag&drop this “y_ID” to the metrics bucket in analytical designer).
• If your table “y” does not have a single column primary key, depending on the GoodData edition you are using, you can:
◦ In GoodData Cloud and GoodData.CN use SELECT COUNT(y)
- here you can use count with the dataset directly
◦ In GoodData Platform use SELECT COUNT(Records of y) - there will be a special attribute Records of … for each dataset without primary key. It is not visible in the Analytical designer list of attributes, you will need to select it in the metric editor.
In any case, this metric that you create this way will be universal. That means it does return number of records in general and can be used with different attributes/columns. To get number of rows by values of ‘x’ just use it together with ‘x’ in the view by/stack by.
To see number of records by some other column ‘z’ just use it with column ‘z’ there. Or combine columns ‘x’ and ‘z’ to see number of occurrences of various combinations of these columns.
basically it represents the COUNT(*)
in your SQL example and the SELECT x,
and FROM y GROUP BY x
or SELECT x,z
and FROM y GROUP BY x,z
are automatic and dynamic based on the metric usage in GoodData.
I hope this helps.Menelaos Kotoglou
06/06/2023, 9:25 PM