hello, I want to ask about MAQL again. I use csv f...
# gooddata-platform
g
hello, I want to ask about MAQL again. I use csv files. I use count syntax to count the number of "Drop Name"
select Count(*Drop Name Master*)
The result of the calculation of the syntax is 5 row. How do I get the count syntax to count all rows. Thank you
i
Hello Giri, I have to admit, it is bit difficult to give any advice without better knowledge of your model. Generally speaking, the Count function returns the number of unique values of an attribute within the given context. How did you upload this Attribute, please? Is this your ConnectionPoint/PrimaryKey or is there any other ConnectionPoint/PrimaryKey set for related dataset? I believe, this is what happened here - since these values are not unique, only the one of them is loaded, deduplicated during the load (in other words, although there is probably a difference in other fields of your CSV - it is still considered as the same and only the latest is loaded).
j
Hi Giri, Count returns number of unique values as Ivana correctly pointed out. If you need to count records of CSV dataset there are two options: 1. Upload unique identifier of each row as additional column of the CSV and set it as primary key in logical data model (e.g. as “Resource Id”). Use this primary key for counting of the records (e.g. “select count(Resource Id)“. 2. Upload fact dataset which includes numeric facts without primary key defined e.g. as dataset “Resources”. GoodData platform provides “Records of Resources” attribute, which can be used for counting of rows of the dataset. MAQL expression for the count metric is then “select count(Records of Resources)”
1