SlideShare a Scribd company logo
in
     How to build
10   a metric in a metric

     Using BY in MAQL




            with Petr Olmer, GoodData Evangelist
What is a metric in a metric?

example 1: average monthly revenue
                                                              There are aggregations
    average from monthly numbers               outer level
                                                                  on two levels.
              total revenue
                                               inner level (by month)
             for each month




example 2: average number of new leads in a quarter

   average from quarterly numbers                           In most cases,
                                                    the aggregations are different.
          number of new leads
            for each quarter                                  Exception:
                                                         average of averages.
GoodData in10 with Petr Olmer: How to build a metric in a metric                       2
Solution

average monthly revenue

    average from monthly numbers                        Average Monthly Revenue:
                                                        SELECT AVG(Monthly Revenue)
              total revenue
             for each month                             Monthly Revenue:
                                                        SELECT SUM(Revenue) BY Close Month/Year




average number of new leads in a quarter

   average from quarterly numbers                       Average Quarterly Leads:
                                                        SELECT AVG(Quarterly Leads)
          number of new leads
            for each quarter                            Quarterly Leads:
                                                        SELECT COUNT(Lead) BY Created Quarter/Year


GoodData in10 with Petr Olmer: How to build a metric in a metric                                     3
Solution in detail

Average Monthly Revenue:
SELECT AVG(Monthly Revenue)
 Outer metric is an aggregation of the inner metric.


Monthly Revenue:
SELECT SUM(Revenue) BY Close Month/Year
Inner metric uses BY to define the aggregation level.


GoodData in10 with Petr Olmer: How to build a metric in a metric   4
Why BY?

You need to define the border between the inner aggregation and the outer one.


                 inner SUM                                         outer AVG

                                                 BY Month



      Without BY, the inner SUM would not know
     where to stop and hand over to the outer AVG.



GoodData in10 with Petr Olmer: How to build a metric in a metric                5
Behind the scenes



                 inner SUM                                           outer AVG

                                                 BY Month

                                              Nov 2010       $450K
                                              Dec 2010       $580K
                                               Jan 2011      $320K               $400K
                                              Feb 2011       $360K
                                             March 2011      $430K
                                              April 2011     $260K
                                                                                  your
    datamart                             behind the scenes                       report


GoodData in10 with Petr Olmer: How to build a metric in a metric                          6
Behind the scenes

                                  You’ve asked for one number and that’s what you get:
                                                            Average monthly revenue



The monthly report is computed but you cannot see it.




                                              Nov 2010       $450K
                                              Dec 2010       $580K
                                               Jan 2011      $320K         $400K
                                              Feb 2011       $360K
                                             March 2011      $430K
                                              April 2011     $260K
                                                                           your
    datamart                       report behind the scenes               report


GoodData in10 with Petr Olmer: How to build a metric in a metric                         7
Automatic (in-report) BY

You don’t need to use BY when the attribute is in the report.

    Month/Year          Revenue        Monthly Revenue      Revenue:
     Nov 2010               $450K           $450K           SELECT SUM(Revenue)
     Dec 2010               $580K           $580K
     Jan 2011               $320K           $320K           Monthly Revenue:
     Feb 2011               $360K           $360K           SELECT SUM(Revenue) BY Month/Year
    March 2011              $430K           $430K
     April 2011             $260K           $260K



             automatic BY
                                         Both metrics return the same numbers
                                       because Month/Year attribute is in the report.


    BY says: Include this attribute in the
    computation. But it’s already there!


GoodData in10 with Petr Olmer: How to build a metric in a metric                                8
BY and BY

You can include more than one attribute in the BY clause.

    SELECT SUM(Revenue) BY Month/Year, Department
    It will return a number for each month and department.

You can have a metric in a metric in a metric in a...
Best Region Leads:                                                 one number only

SELECT MAX(Average Monthly/Region Leads)
Average Monthly/Region Leads:        one number for each region
SELECT AVG(Month/Region Leads) BY Region
Month/Region Leads:          one number for each month and region
SELECT COUNT(Lead) BY Month/Year, Region
GoodData in10 with Petr Olmer: How to build a metric in a metric                     9
Off you go...

Find the border.

                              average from region numbers

                                        total revenue
                                       for each region




Put BY into the inner metric.
                         SELECT SUM(Revenue) BY Region




GoodData in10 with Petr Olmer: How to build a metric in a metric   10

More Related Content

PPTX
6 tableau visualization tips to inspire your creative eyes
PDF
2015 01-29 keboola meet up
PPTX
Rozvoj webové analytiky díky Universal Analytics
PDF
Co dělá Keboola / bohatství se skrývá v datech
PDF
Webinář Keboola a GoodData
PDF
Technologický background DámeJídlo
PDF
RFM analýza
PDF
Analytika v B2B světě
6 tableau visualization tips to inspire your creative eyes
2015 01-29 keboola meet up
Rozvoj webové analytiky díky Universal Analytics
Co dělá Keboola / bohatství se skrývá v datech
Webinář Keboola a GoodData
Technologický background DámeJídlo
RFM analýza
Analytika v B2B světě

Viewers also liked (11)

PDF
Affiliate program v telco segmentu
PPTX
Nabil Malik - Security performance metrics
PDF
Measuring Effectiveness
PPT
Helpdesk
PDF
Metrics & Analytics That Matter - Steve Krull, CEO, Be Found Online
PDF
Lean Workbench For Creating And Tracking Metrics That Matter
PDF
DataPower Operations Dashboard
PPTX
Action Trumps Everything
PPTX
Analytics and Reporting: Measuring Success Along the Journey
PPTX
Metrics that Matter
PPTX
Security Metrics Program
Affiliate program v telco segmentu
Nabil Malik - Security performance metrics
Measuring Effectiveness
Helpdesk
Metrics & Analytics That Matter - Steve Krull, CEO, Be Found Online
Lean Workbench For Creating And Tracking Metrics That Matter
DataPower Operations Dashboard
Action Trumps Everything
Analytics and Reporting: Measuring Success Along the Journey
Metrics that Matter
Security Metrics Program
Ad

Similar to in10: How to build a metric in a metric (20)

PDF
Business Intelligence Portfolio
PDF
Business Intelligence Portfolio
PDF
Number Crunch: Cash Flow Planning and Financial Analysis
XLS
Income Projections
PDF
Presentation: Dr Yun - Charlotte
PPT
Financial Accounting Presentation from ABA Annual Meeting
PPTX
20 Vital Sales and Marketing Metrics
PDF
Common Mistakes and Missed Optimization Opportunities in SQL
 
PDF
2009 Q1 E Final
PPSX
Vision Analysis Cubes
PPTX
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
PPT
What's new in Apache Hive
PPTX
Excel Pivot Tables
XLS
PDF
Enterprise Training
PDF
Mas 90-mas-200-general-ledger-1x
PDF
Grouping sets sfpug_20141118
PPTX
BI Portfolio
PDF
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Business Intelligence Portfolio
Business Intelligence Portfolio
Number Crunch: Cash Flow Planning and Financial Analysis
Income Projections
Presentation: Dr Yun - Charlotte
Financial Accounting Presentation from ABA Annual Meeting
20 Vital Sales and Marketing Metrics
Common Mistakes and Missed Optimization Opportunities in SQL
 
2009 Q1 E Final
Vision Analysis Cubes
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
What's new in Apache Hive
Excel Pivot Tables
Enterprise Training
Mas 90-mas-200-general-ledger-1x
Grouping sets sfpug_20141118
BI Portfolio
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Ad

More from Petr Olmer (6)

PDF
The World Through The Lens Of A Two-Year-Old
PDF
How to scale (with Big Data)
PDF
Do Ameriky (WebExpo Prague 2012)
PDF
Embed GoodData Analytics in Your Force.com App
PDF
in10: How to start with GoodData for Salesforce
PDF
Business Intelligence Platform as a Service: Introduction to GoodData
The World Through The Lens Of A Two-Year-Old
How to scale (with Big Data)
Do Ameriky (WebExpo Prague 2012)
Embed GoodData Analytics in Your Force.com App
in10: How to start with GoodData for Salesforce
Business Intelligence Platform as a Service: Introduction to GoodData

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Programs and apps: productivity, graphics, security and other tools
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Tartificialntelligence_presentation.pptx
1. Introduction to Computer Programming.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Machine learning based COVID-19 study performance prediction
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton

in10: How to build a metric in a metric

  • 1. in How to build 10 a metric in a metric Using BY in MAQL with Petr Olmer, GoodData Evangelist
  • 2. What is a metric in a metric? example 1: average monthly revenue There are aggregations average from monthly numbers outer level on two levels. total revenue inner level (by month) for each month example 2: average number of new leads in a quarter average from quarterly numbers In most cases, the aggregations are different. number of new leads for each quarter Exception: average of averages. GoodData in10 with Petr Olmer: How to build a metric in a metric 2
  • 3. Solution average monthly revenue average from monthly numbers Average Monthly Revenue: SELECT AVG(Monthly Revenue) total revenue for each month Monthly Revenue: SELECT SUM(Revenue) BY Close Month/Year average number of new leads in a quarter average from quarterly numbers Average Quarterly Leads: SELECT AVG(Quarterly Leads) number of new leads for each quarter Quarterly Leads: SELECT COUNT(Lead) BY Created Quarter/Year GoodData in10 with Petr Olmer: How to build a metric in a metric 3
  • 4. Solution in detail Average Monthly Revenue: SELECT AVG(Monthly Revenue) Outer metric is an aggregation of the inner metric. Monthly Revenue: SELECT SUM(Revenue) BY Close Month/Year Inner metric uses BY to define the aggregation level. GoodData in10 with Petr Olmer: How to build a metric in a metric 4
  • 5. Why BY? You need to define the border between the inner aggregation and the outer one. inner SUM outer AVG BY Month Without BY, the inner SUM would not know where to stop and hand over to the outer AVG. GoodData in10 with Petr Olmer: How to build a metric in a metric 5
  • 6. Behind the scenes inner SUM outer AVG BY Month Nov 2010 $450K Dec 2010 $580K Jan 2011 $320K $400K Feb 2011 $360K March 2011 $430K April 2011 $260K your datamart behind the scenes report GoodData in10 with Petr Olmer: How to build a metric in a metric 6
  • 7. Behind the scenes You’ve asked for one number and that’s what you get: Average monthly revenue The monthly report is computed but you cannot see it. Nov 2010 $450K Dec 2010 $580K Jan 2011 $320K $400K Feb 2011 $360K March 2011 $430K April 2011 $260K your datamart report behind the scenes report GoodData in10 with Petr Olmer: How to build a metric in a metric 7
  • 8. Automatic (in-report) BY You don’t need to use BY when the attribute is in the report. Month/Year Revenue Monthly Revenue Revenue: Nov 2010 $450K $450K SELECT SUM(Revenue) Dec 2010 $580K $580K Jan 2011 $320K $320K Monthly Revenue: Feb 2011 $360K $360K SELECT SUM(Revenue) BY Month/Year March 2011 $430K $430K April 2011 $260K $260K automatic BY Both metrics return the same numbers because Month/Year attribute is in the report. BY says: Include this attribute in the computation. But it’s already there! GoodData in10 with Petr Olmer: How to build a metric in a metric 8
  • 9. BY and BY You can include more than one attribute in the BY clause. SELECT SUM(Revenue) BY Month/Year, Department It will return a number for each month and department. You can have a metric in a metric in a metric in a... Best Region Leads: one number only SELECT MAX(Average Monthly/Region Leads) Average Monthly/Region Leads: one number for each region SELECT AVG(Month/Region Leads) BY Region Month/Region Leads: one number for each month and region SELECT COUNT(Lead) BY Month/Year, Region GoodData in10 with Petr Olmer: How to build a metric in a metric 9
  • 10. Off you go... Find the border. average from region numbers total revenue for each region Put BY into the inner metric. SELECT SUM(Revenue) BY Region GoodData in10 with Petr Olmer: How to build a metric in a metric 10