How to do multi-dimension summations on a table. ...
# gd-beginners
d
How to do multi-dimension summations on a table. I've got the first ones to work. I'm not sure i know how to do is the summations on the first level of the dimension and not just the second, For example: The percent of Primary for example would be 3.9% for "Account set up" Primary (3.6+.1+.1+.1) and it would repeat for each row for the 5 rows.
m
Hi Doug, I would like to suggest that you use the “BY” clause in your metric. The BY keyword is used to set a minimum level of granularity by which a metric can be broken down. More details can be found here: https://www.gooddata.com/docs/cloud/create-metrics/maql/filters/overriding-attribute-filters/by/#by-clauses-with-one-attribute You can set the granularity on the “Primary” level and this should give you the desired result. Please see this section for more details: By Clauses with One Attribute
d
I've already been using BY (See below) for the other metrics but can't get this one to work, i have gotten the incorrect answers (See pictures) I tried both
Copy code
SELECT ( SELECT COUNT({label/cases.case_interaction_id}))
/ (SELECT COUNT({label/cases.case_interaction_id}) BY {label/contact_driver_primary}
WHERE {label/contact_driver_primary} <> "No Value")
Copy code
SELECT ( SELECT COUNT({label/cases.case_interaction_id}))
/ (SELECT COUNT({label/cases.case_interaction_id}) BY ALL {label/contact_driver_primary}
WHERE {label/contact_driver_primary} <> "No Value")
THESE ALREADY WORK This is for % of Primary
Copy code
SELECT ( SELECT COUNT({label/cases.case_interaction_id}))
/ (SELECT COUNT({label/cases.case_interaction_id}) BY ALL {label/contact_driver_secondary}
WHERE {label/contact_driver_primary} <> "No Value")
This is for % of total
Copy code
SELECT ( SELECT COUNT({label/cases.case_interaction_id}))
/ (SELECT COUNT({label/cases.case_interaction_id}) BY ALL OTHER
WHERE {label/contact_driver_primary} <> "No Value")
Is there something else I can use in addition to "BY"
m
Hi Doug, sorry for the delay in getting back to you here - I was just wondering if you made any progress with your metrics? If you’re still having issues, would you please be so kind as to provide more details on the issue tell me what you’re seeing there now versus what you would expect to see there?
d
It doesn't seem to me what I want is possible
In the table I can do whats in Green, but I can't do it in red. Hopefully thats clear
m
Hi Doug, my apologies for the delay in getting back to you I was away for a few days. Please see my testing report attached below where I was able to achieve the type of report you’re after there. In my metric I used the following operator: https://www.gooddata.com/docs/cloud/create-metrics/maql/filters/overriding-attribute-filters/by-attribute-all-in-all-other-dimensions/ Your metric would look something like this:
Copy code
SELECT ( SELECT COUNT({label/cases.case_interaction_id}))
/ (SELECT COUNT({label/cases.case_interaction_id}) BY {label/contact_driver_primary}
ALL OTHER
d
Thanks, I'll give it a try
Hmm, @Michael Ullock I did not have the same experience