please reply
# gd-beginners
g
please reply
j
Hi, the count our platform uses is a bit different when comparing to SQL… this is visible in our documentation and also here https://community.gooddata.com/metrics-and-maql-kb-articles-43/how-to-use-maql-count-in-gooddata-platform-301 pls find some time to go through the docu.
f
Hi Gaurav, Please allow me to jump in here an provide some extra context on GoodData and how data is modeled. The SQL query you sent would be used to count the number of user IDs from the User Course Assignments table which are present in the Courses table (which is what the JOIN operator would be used for), as a new table with the two values displayed, correct? In GoodData, we don’t have to worry about doing JOINs at all. Instead, we create a Logical Data Model (or LDM) which establishes all of the relationships between your tables (or Datasets, in GoodData lingo); Then, we can simply make SELECT statements and slice them by the data in the model, without having to create a JOIN query. To illustrate that, I have created a simple LDM based on your description of the datasets. I created it based on a few CSV files I made up. One of them contains the User info (with the UserIDs and their Names), and another one contains the Course infos (Course ID and Course Name). Finally, I also created a third table called Course Assignments where I listed only the UserIDs and CourseIDs, basically assigning a user to each course. Then, I added them to my Logical Data Model using the steps from https://help.gooddata.com/doc/enterprise/en/data-integration/data-modeling-in-gooddata/create-a-logical-data-model-from-csv-files/ I have attached screenshot examples. See the screenshot labelled #1. Note how the arrows connecting each data set establish how they are related to each other. In this case, we are telling the LDM that the Courseassignments table is referencing data from the other two datasets, Users and Courses, via the Userid and Courseid attributes (or Columns, in the original tables). Our goal is to display a Count of Users assigned to each Course, correct? The simplest way to do that is via the Analytical Designer. I accessed it via the Analyze tab. Then, I dragged the User ID Attribute from the list into the Metric slot. It automatically creates a COUNT(User ID) metric for us. See screenshot #2 Then, I added the CourseName attribute to the Rows slot. This will slice the Count of User ID with the Course Name. There is no JOIN necessary, because the relationship between the datasets is already set up via the LDM. See the results on screenshot #3 Of course, nothing would stop me from creating a MAQL query for the User ID count. I could do it like so: 1. I selected Create Metric from the bottom of the attribute list, on the Analytical Designer; 2. I simply inserted the query SELECT COUNT(UserID); 3. Voilá (screenshots #4 ) It now appears in the list on the Analytical Designer (#5) The end result is exactly the same, after I dragged the Count of User ID metric to the Metric slot and sliced it by Coursename (see the final screenshot, labelled #6) The creation of Metrics will become more important when we have more complex operations to perform, but often your users will be able to perform a lot of analysis just by using the Analytical Designer, depending on the use case. I hope you understand a bit better how the Logical Data Model works, and how it underpins all the analytics in the platform. With that in mind, we would very much like to see your LDM before troubleshooting further, moving forward. A simple screenshot of the model (like the one I sent above) is usually quite helpful. Please let us know if you have any other questions about GoodData.
🙌 4