Author: lidong
Date: Thu Mar 31 14:09:40 2022
New Revision: 1899440

URL: http://svn.apache.org/viewvc?rev=1899440&view=rev
Log:
# add blog: how to use excel to query kylin

Added:
    kylin/site/blog/2022/03/31/
    kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/
    kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html
    kylin/site/cn_blog/2022/03/31/
    kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/
    kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html
    kylin/site/images/blog/how_to_use_excel_to_query_kylin/
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.en.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.cn.png
   (with props)
    
kylin/site/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.en.png
   (with props)
Modified:
    kylin/site/blog/index.html
    kylin/site/cn/blog/index.html
    kylin/site/feed.xml

Added: kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html
URL: 
http://svn.apache.org/viewvc/kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html?rev=1899440&view=auto
==============================================================================
--- kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html 
(added)
+++ kylin/site/blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html Thu 
Mar 31 14:09:40 2022
@@ -0,0 +1,677 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<!doctype html>
+<html>
+       <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+
+  <title>Apache Kylin | How to use Excel to query Kylin? MDX for Kylin!</title>
+  <meta name="description" content="Abstract">
+  <meta name="author"      content="Apache Kylin">
+  <link rel="shortcut icon" href="fav.png" type="image/png">
+
+
+
+<link rel="stylesheet" href="/assets/css/animate.css">
+<!-- Bootstrap -->
+<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
+
+<!-- Fonts -->
+<!-- <link rel="stylesheet" 
href="http://fonts.googleapis.com/css?family=Alice|Open+Sans:400,300,700"> -->
+
+<!-- Icons -->
+<link rel="stylesheet" href="/assets/css/font-awesome.min.css">
+
+  <!-- Custom styles -->
+  <link rel="stylesheet" href="/assets/css/styles.css">
+  <link rel="stylesheet" href="/assets/css/docs.css">
+  <link rel="stylesheet" href="/assets/css/pygments.css">
+
+  <link rel="canonical" 
href="http://kylin.apache.org/blog/2022/03/31/how-to-use-excel-to-query-kylin/";>
+  <link rel="alternate" type="application/rss+xml" title="Apache Kylin" 
href="http://kylin.apache.org/feed.xml"; />
+
+<!--[if lt IE 9]> <script src="assets/js/html5shiv.js"></script> <![endif]-->
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async 
src="https://www.googletagmanager.com/gtag/js?id=UA-120788561-1";></script>
+<script>
+  window.dataLayer = window.dataLayer || [];
+  function gtag(){dataLayer.push(arguments);}
+  gtag('js', new Date());
+
+  gtag('config', 'UA-120788561-1');
+</script>
+<script type="text/javascript" src="/assets/js/jquery-1.9.1.min.js"></script>
+<script type="text/javascript" src="/assets/js/nside.js"></script> </script>
+<script type="text/javascript" src="/assets/js/nnav.js"></script> </script>
+<script>
+var _hmt = _hmt || [];
+(function() {
+  var hm = document.createElement("script");
+  hm.src = "https://hm.baidu.com/hm.js?bdc5e03add430c0b72cc0eb91eabfa99";;
+  var s = document.getElementsByTagName("script")[0]; 
+  s.parentNode.insertBefore(hm, s);
+})();
+</script>
+
+</head>
+
+       <body>
+               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<header id="header" >
+  
+  <!-- Main Menu -->
+  <nav class="navbar navbar-default" role="navigation" id="nav-wrapper">
+    <div class="container-fluid" id="nav">
+      <!--
+      <img class="img-circle" width="40px" height="40px" id="circlelogo" 
src="/assets/images/kylin_logo.jpg">
+      -->
+      <!-- Brand and toggle get grouped for better mobile display -->
+      <div class="navbar-header">
+        <img class="navbar-logo" width="46" 
src="/assets/images/kylin_logo.png" ></img>
+        <button type="button" class="navbar-toggle collapsed" 
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+          <span class="sr-only">Toggle navigation</span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </button>
+        <ul class="nav icon-navbar">
+            <li><a href="https://twitter.com/apachekylin"; target="_blank" 
class="fa fa-twitter fa-lg"  title="Twitter: @ApacheKylin" ></a></li>
+            <li><a href="https://github.com/apache/kylin"; target="_blank" 
class="fa fa-github-alt fa-lg" title="Github: apache/kylin" ></a></li>
+            <li><a href="https://www.facebook.com/kylinio"; target="_blank" 
class="fa fa-facebook fa-lg" title="Facebook: kylin.io" ></a></li>
+        </ul>
+      </div>
+
+      <!-- Collect the nav links, forms, and other content for toggling -->
+      <div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1">
+
+        <ul class="nav navbar-nav">
+
+          <li><a href="/">Home</a></li>
+          <li>
+            <a href="/docs" class="dropdown-toggle" data-toggle="dropdown" 
role="button" aria-haspopup="true" aria-expanded="false">Docs<span 
class="caret"></span></a>
+            <ul class="dropdown-menu">
+              <li><a href="/docs/">Latest Release(Kylin 4.0.1)</a></li>
+              <li><a href="/docs31/">Kylin 3.1.3</a></li>
+              <li><a href="/docs24/">Kylin 2.4.0</a></li>
+              <li><a href="/archive/">Archive</a></li>
+            </ul>
+          </li>
+          <li><a href="/download">Download</a></li>
+          <li><a href="/community" >Community</a></li>
+          <li>
+            <a href="/development" class="dropdown-toggle" 
data-toggle="dropdown" role="button" aria-haspopup="true" 
aria-expanded="false">Development<span class="caret"></span></a>
+            <ul class="dropdown-menu">
+              <li><a href="/development40/">Kylin 4.x</a></li>
+              <li><a href="/development/">Kylin 3.x And Older Versions</a></li>
+            </ul>
+          </li>
+          <li><a href="/blog">Blog</a></li>
+          <li><a href="/cn" >中文版</a></li> 
+        </ul>     
+      </div><!-- /.navbar-collapse -->
+    </div><!-- /.container-fluid -->
+  </nav>
+
+  <div id="head" class="parallax normal-header" >
+    <div class="text-center header-apache">
+      <a href="http://apache.org/foundation/contributing.html"; title="Support 
Apache" style="margin-left: 150px;">
+        <div>
+          <img src="https://www.apache.org/images/SupportApache-small.png"; >
+        </div>
+      </a>
+    </div>  
+  </div>
+  
+ </header>
+
+               <div class="page-content main">
+                       <header style=" padding:2em 0 0 ">
+                       <div class="container" >
+                         <div style=" padding:0 4em">
+                <div class="blog-icon">
+                  <img width="30" src="/assets/images/icon_blog_w.png">
+                </div>
+                               <h4 class="index-title" style=" 
float:left;"><span>Apache Kylin™ Technical Blog</span></h4>
+                         </div>
+                       </div>
+               </div>
+
+               <div class="container blog">
+                       <div>
+                               <article class="post-content" > 
+                               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<div class="post" style=" padding:2em 4em 4em 4em">
+
+  <header class="post-header">
+    <h1 class="post-title">How to use Excel to query Kylin? MDX for Kylin!</h1>
+    <p class="post-meta" >Mar 31, 2022 • Xiaoxiang Yu</p>
+  </header>
+
+  <article class="post-content" >
+    <h2 id="abstract"><strong>Abstract</strong></h2>
+
+<p>During the <a 
href="https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv";>Kylin 
community discussion</a> at the beginning of this year, we talked about the 
positioning of multidimensional databases and the idea of building a 
Kylin-based business semantic layer. After some development efforts, we are 
delighted to announce the beta release of the <strong>MDX</strong> <strong>for 
Kylin</strong> <strong>, an MDX query engine for Apache Kylin</strong> to allow 
Kylin users to use <strong>Excel</strong> for data analysis.</p>
+
+<h4 id="target-audiences"><strong>Target audiences</strong></h4>
+
+<ul>
+  <li>
+    <p>Kylin users who are not familiar with <strong>MDX</strong></p>
+  </li>
+  <li>
+    <p>Data engineers who are interested in building a <strong>metrics 
platform</strong> based on Kylin</p>
+  </li>
+  <li>
+    <p>Data analysts who are interested in massive data analysis with 
<strong>Excel</strong></p>
+  </li>
+</ul>
+
+<h4 id="what-you-will-learn"><strong>What you will learn</strong></h4>
+
+<ul>
+  <li>
+    <p>Basic concepts of MDX and MDX for Kylin</p>
+  </li>
+  <li>
+    <p>Quickstart tutorial for MDX for Kylin</p>
+  </li>
+  <li>
+    <p>Demonstration of how to use MDX for Kylin to define complex business 
metrics</p>
+  </li>
+</ul>
+
+<h2 id="why-kylin-need-mdx"><strong>Why Kylin need MDX?</strong></h2>
+
+<h3 
id="multidimensional-database-and-business-semantic-layer"><strong>Multidimensional
 database and business semantic layer</strong></h3>
+
+<p>The primary difference between multidimensional databases and relational 
databases lies in business semantics. As the must-have skill of data analysts, 
SQL (Structured Query Language) is extremely expressive, but if we are talking 
in the context of “every professional will be an analyst”, it is still too 
complex for non-technical users. For them, data lakes and data warehouses are 
like dark rooms that hold a huge amount of data; they cannot see, understand, 
or use the data for lack of the fundamental knowledge of databases and SQL 
syntax.</p>
+
+<p>How to make data lakes and data warehouses <strong>“easy”</strong> for 
a non-technical user to use? One solution is to introduce a more user-friendly 
<strong>“relational data model - multidimensional data model”</strong>. If 
relational models are to provide a technique-oriented description of the data, 
multidimensional models intend to provide a business-oriented description of 
the data. In multidimensional databases, measures correspond to the business 
metrics that everyone is familiar with. Measures provide the analytic 
perspective to check and compare these business metrics. For example, it is 
like comparing the KPIs between this month and last month, or the performance 
of different business departments. By mapping the relational model to a 
multidimensional model, we add a business semantic layer on top of the 
technical data, thus helping non-technical users understand, explore, and use 
data.</p>
+
+<p>In Kylin Roadmap, support to multidimensional query languages (such as MDX 
and DAX) is an important part, as we aim to enhance the business semantic 
capability of Kylin as a multi-dimensional database. Users can use MDX to 
convert the Kylin data model into business-friendly language, so they can 
perform multidimensional analysis with Excel, Tableau and other BI tools and 
understand the business values from their data.</p>
+
+<h3 id="build-a-business-metrics-platform-with-mdx"><strong>Build a business 
metrics platform with MDX</strong></h3>
+
+<p>When building complex business metrics, MDX provides the following 
advantages if compared to SQL:</p>
+
+<ol>
+  <li><strong>Better support for complex analysis scenarios</strong>, such as 
semi-accumulation, many-to-many, and time window analysis;</li>
+  <li><strong>More BI support</strong>: “Kylin + MDX” can be exposed as 
relational database tables through the SQL interface, or XMLA-compliant data 
source with business semantics. It allows MDX queries and integration with 
Excel and other BI tools through the XMLA protocol;</li>
+  <li><strong>Flexible defining of MDX semantic model based on Kylin data 
model</strong>, it will convert the underlying data structure into a 
business-friendly language and add business value to data. With MDX model, we 
offer users a unified business semantic layer, they no longer need to worry 
about the underlying technology or implementation complexity when analyzing 
data. For more information, see <em><a 
href="https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv";>The 
future of Apache Kylin</a></em>, <em><a 
href="https://kyligence.io/blog/opportunities-for-ssas-in-the-cloud/";>SSAS 
Disadvantages: Opportunities for SSAS in the Cloud Era</a></em>, and <em><a 
href="https://kyligence.io/blog/semantic-layer-the-bi-trend-you-dont-want-to-miss-in-2020/";>Semantic
 Layer: The BI Trend You Don’t Want to Miss</a>**.</em></li>
+</ol>
+
+<h3 id="mdx-overview"><strong>MDX Overview</strong></h3>
+
+<h4 id="what-is-mdx"><strong>What is MDX?</strong></h4>
+
+<p>MDX (Multi Dimensional eXpression) is a query language for OLAP Cube. It 
was first introduced by Microsoft in 1997 as part of the OLEDB for OLAP 
specification and later integrated into SSAS. Since then, it has been widely 
adopted by OLAP databases.</p>
+
+<p>MDX is similar to SQL in many ways and also offers some SQL features though 
maybe not as intuitive or effective as SQL. For example, you can include 
SELECT, FROM, or WHERE clause in your MDX queries. But it is not an extension 
of SQL. You can use these keywords to dig into specific parts of the Cube.</p>
+
+<p><a 
href="https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx?view=sql-server-ver15";>MDX
 query syntax </a>are as follows:</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code><span 
class="k">select</span> <span class="o">&lt;</span><span 
class="n">axis_specification</span><span class="o">&gt;</span><span 
class="p">[,</span> <span class="o">&lt;</span><span 
class="n">axis_specification</span><span class="o">&gt;</span><span 
class="p">]</span>
+ <span class="k">from</span> <span class="o">&lt;</span><span 
class="n">cube_specification</span><span class="o">&gt;</span>
+ <span class="k">where</span> <span class="o">&lt;</span><span 
class="n">slicer_specification</span><span class="o">&gt;</span>
+</code></pre>
+</div>
+
+<h4 id="key-concepts-of-mdx"><strong>Key concepts of MDX</strong></h4>
+
+<p>Please learn some basic MDX concepts before we continue.</p>
+
+<ol>
+  <li>Dimensions, Levels, Members, and Measures</li>
+  <li>Cell, Tuple, and Set</li>
+  <li>Query Axis and Slicer Axis</li>
+</ol>
+
+<p>For detailed information about these concepts, see <a 
href="https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx?view=sql-server-ver15";>MDX
 Syntax Elements (MDX)</a>.</p>
+
+<h4 id="comparison-of-mdx-and-sql"><strong>Comparison of MDX and 
SQL</strong></h4>
+
+<p>The query objects are different. MDX is to query the cube, with data 
already joined and aggregated, so users needn’t specify the join relation 
when querying. SQL is to query a table with detailed records. Users need to 
specify the join relation among the tables when querying.</p>
+
+<p><a 
href="https://dba.stackexchange.com/questions/138311/good-example-of-mdx-vs-sql-for-analytical-queries";>Another
 difference is the query result</a>. SQL returns a 2d data subset, while MDX 
returns the cubes.</p>
+
+<h3 id="mdx-for-kylin-overview"><strong>MDX for Kylin</strong> 
<strong>Overview</strong></h3>
+
+<h4 id="what-is-mdx-for-kylin"><strong>What is</strong> <strong>MDX for 
Kylin</strong>?</h4>
+
+<p><strong>MDX for Kylin</strong> is an MDX query engine which developed based 
on <strong>Mondrian</strong>, contributed by <strong>Kyligence,</strong> and 
with <strong>Apache Kylin</strong> as data source. Like Microsoft SSAS, MDX for 
Kylin can also integrate many data analysis tools, including Microsoft Excel 
and Tableau, to provide a better user experience for big data analysis.</p>
+
+<h4 id="how-to-create-business-metrics"><strong>How</strong> <strong>to create 
business metrics</strong></h4>
+
+<h5 id="atomic-metrics-and-business-metrics"><strong>Atomic metrics and 
business metrics</strong></h5>
+
+<p>In Kylin Cube, we will perform certain aggregate calculations (such as 
Sum/Max/Min/Count/Count Distinct, exclude TopN) on a single column when 
creating measures, and the measures created are called atomic metrics.</p>
+
+<p>In actual business scenarios, we can run complex calculations based on 
these atomic metrics to create composite metrics with business implications, 
and these metrics are called business metrics.</p>
+
+<h5 id="hierarchy-calculated-measure-and-namedset"><strong>Hierarchy, 
Calculated Measure, and NamedSet</strong></h5>
+
+<p><strong>Hierarchy:</strong> Hierarchies are collections of dimension-based 
hierarchies that can empower data analysts with advanced analytical 
capabilities. For example, you can create a time hierarchy with year, quarter, 
month, week, and day as its hierarchy. Then data analysts can do a YOY analysis 
on the sales volume, or dig into the “Quarter &gt; Month &gt; Week &gt; 
Day” hierarchy for more detailed analysis.</p>
+
+<p><strong>Calculated Measure:</strong> Calculated Measure are metrics/indexes 
acquired by running composite computing on the <strong>atomic metrics</strong> 
with MDX expressions. We mainly use calculated measures to create 
<strong>business metrics</strong>.</p>
+
+<p><strong>NamedSet:</strong> Namedset is for the scenario when you need to 
reuse a set of members in MDX for Kylin. A NamedSet uses specified expressions 
to get the set members. It can be placed directly on the axis or used in 
expressions of Calculated Measure for or other Namedset.</p>
+
+<h4 id="dataset-as-semantic-model"><strong>Dataset as</strong> 
<strong>semantic model</strong></h4>
+
+<p>In Kylin 4, we create a data model based on the relationship among tables, 
and define different dimensions and measures on the Cube. These measures are 
<strong>atomic metrics</strong>.</p>
+
+<p>In MDX for Kylin, we join related Kylin Cubes to create datasets and create 
<strong>business metrics</strong> based on atomic metrics.</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h4 id="process-of-calculating"><strong>Process of calculating</strong></h4>
+
+<p>The client(BI/Excel) sends an MDX query to MDX for Kylin, which will then 
be parsed into SQL and sent to Kylin. After that, Kylin will answer the SQL 
query based on the pre-computed Cuboid and return the result to MDX for Kylin. 
Then, MDX for Kylin will do some derived metrics calculation, and return the 
multidimensional data results to the client.</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h4 id="summary"><strong>Summary</strong></h4>
+
+<p><strong>MDX for</strong> <strong>Kylin</strong> supports MDX interface 
enhancing the semantic capability and creates a unified data analysis and 
management user experience. Now users can better leverage the value of data. 
The figure below shows the process of how raw data is processed into business 
metrics.</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h3 id="technical-advantages-of-mdx-for-kylin"><strong>Technical advantages 
of</strong> <strong>MDX for Kylin</strong></h3>
+
+<p>If compared with other open-source MDX query engines, MDX for Kylin has the 
following advantages:</p>
+
+<ul>
+  <li>
+    <p>Better support to BIs (Excel/Tableau/Power BI, etc.)and compliance with 
XMLA protocol</p>
+  </li>
+  <li>
+    <p>Optimize the MDX Query for BIs</p>
+  </li>
+  <li>
+    <p>Accelerate MDX queries with Kylin’s pre-computing capability</p>
+  </li>
+  <li>
+    <p>Easy-to-use interface for metrics definition and management</p>
+  </li>
+</ul>
+
+<h2 id="quick-start-with-docker"><strong>Quick start with Docker</strong></h2>
+
+<h4 id="test-environment"><strong>Test environment</strong></h4>
+
+<ul>
+  <li>MacBook Pro: Docker Desktop (latest version)</li>
+  <li>Windows 10 virtual machine: Microsoft Excel (for Windows)</li>
+</ul>
+
+<h4 id="start-the-container"><strong>Start the container</strong></h4>
+
+<pre><code class="language-she">docker run -d \
+    -m 8g \
+    -p 7070:7070 \
+    -p 7080:7080 \
+    -p 8088:8088 \
+    -p 50070:50070 \
+    -p 8032:8032 \
+    -p 8042:8042 \
+    -p 2181:2181 \
+    --name kylin-4.0.1 \
+    apachekylin/apache-kylin-standalone:kylin-4.0.1-mondrian
+</code></pre>
+
+<h4 id="environment-check">Environment Check</h4>
+
+<p>Wait for a few minutes, then check if you can visit the web UI of HDFS, 
YARN, Kylin, and MDX for Kylin.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th><strong>Components</strong></th>
+      <th><strong>Web UI</strong></th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>HDFS</td>
+      <td>http://localhost:50070/dfshealth.html</td>
+    </tr>
+    <tr>
+      <td>YARN</td>
+      <td>http://localhost:8088/cluster</td>
+    </tr>
+    <tr>
+      <td>Kylin</td>
+      <td>http://localhost:7070/kylin</td>
+    </tr>
+    <tr>
+      <td>MDX for Kylin</td>
+      <td>http://localhost:7080/overview</td>
+    </tr>
+  </tbody>
+</table>
+
+<h4 id="build-a-sample-cube">Build a sample Cube</h4>
+
+<p>In this tutorial, we will use Kylin’s built-in sample Cube: <code 
class="highlighter-rouge">kylin_sales_cube</code></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h4 id="create-a-mdx-dataset">Create a MDX dataset</h4>
+
+<h5 id="log-in-to-mdx-for-kylin"><strong>Log in to</strong> <strong>MDX for 
Kylin</strong></h5>
+
+<p>Log in to MDX for Kylin through the web UI: http://localhost:7080. The 
default account/password is <strong>ADMIN/KYLIN</strong>, the same as Kylin.</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h5 id="define-the-dataset-and-relations">Define the dataset and relations</h5>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h5 id="create-a-time-hierarchy"><strong>Create a time hierarchy</strong></h5>
+
+<ul>
+  <li>Configure the dimension table <code 
class="highlighter-rouge">KYLIN_CAL_DT</code>.</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Configure the column <code class="highlighter-rouge">YEAR_BEG_DT</code>, 
and set <strong>Type</strong> to <strong>Year</strong>.</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Configure <code class="highlighter-rouge">MONTH_BEG_DT</code>and <code 
class="highlighter-rouge">WEEK_BEG_DT</code>, set them to the correspondent 
hierarchy.</li>
+  <li>Create a time hierarchy <code class="highlighter-rouge">Calendar</code>. 
Please be noted the time hierarchy should be in a “year-month-week” 
order.</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h5 id="rename-the-atomic-metrics"><strong>Rename the atomic 
metrics</strong></h5>
+
+<p>Rename the atomic metric <code class="highlighter-rouge">GMV_SUM</code> to 
some names with business implications. In this tutorial, we named it as 
<strong>Sales volume</strong>, and renamed <code 
class="highlighter-rouge">SELLER_CNT_HLL</code> as <strong>Retailer 
numbers</strong>.</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h5 id="create-business-metrics-calculated-measures"><strong>Create business 
metrics (calculated measures)</strong></h5>
+
+<ul>
+  <li>Create the business metric <strong>Av</strong><strong>erage sales volume 
of</strong> <strong>retailers</strong>.</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Build “YoY growth rate of sales volume” and “MoM growth rate of 
sales volume” sequentially.</li>
+</ul>
+
+<table>
+  <thead>
+    <tr>
+      <th>Metrics</th>
+      <th><strong>MDX Expression</strong></th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Average sales volume of retailers</td>
+      <td>[Measures].[Sales volume]/[Measures].[Retailer number]</td>
+    </tr>
+    <tr>
+      <td>YoY growth rate of sales volume</td>
+      <td>[Measures].[Sales volume] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[YEAR_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[Sales 
volume] ) - 1</td>
+    </tr>
+    <tr>
+      <td>MoM growth rate of sales volume</td>
+      <td>[Measures].[Sales volume] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[MONTH_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[Sales 
volume] ) - 1</td>
+    </tr>
+    <tr>
+      <td>Total sales volume</td>
+      <td>Fixed([KYLIN_CAL_DT].[YEAR_BEG_DT], [Measures].[Sales volume])</td>
+    </tr>
+    <tr>
+      <td>Proportion in total annual sales volume</td>
+      <td>[Measures].[Sales volume]/[Measures].[Total sales volume]</td>
+    </tr>
+  </tbody>
+</table>
+
+<h4 id="access-business-metrics-through-excel-pivot-tables"><strong>Access 
business metrics through Excel pivot tables</strong></h4>
+
+<h5 id="connect-mdx-for-kylin"><strong>Connect</strong> <strong>MDX for 
Kylin</strong><strong>!</strong></h5>
+
+<ul>
+  <li>Open Microsoft Excel (for Windows)</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Configure the MDX for Kylin server address. Please update the IP_Adress 
with your IP address, and use Kylin’s account and password(ADMIN/KYLIN in 
this case).</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h5 id="check-sales-volume-with-pivot-tables">Check sales volume with pivot 
tables</h5>
+
+<ul>
+  <li>Configure pivot table</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Check YoY growth rate of sales volume</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<ul>
+  <li>Check MoM growth rate of sales volume</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.en.png"
 alt="" /></p>
+
+<h4 id="call-api-to-query-mdx-for-kylin">Call API to query MDX for Kylin</h4>
+
+<p>If you do NOT have a windows version Excel, you can also use REST API to 
test the business metrics just created.  Note: please change the variables in 
the <code class="highlighter-rouge">&lt;Statement&gt;</code> <code 
class="highlighter-rouge">&lt;/Statement&gt;</code> section based on your 
setting and update the value of <code class="highlighter-rouge">Catalog</code> 
if needed.</p>
+
+<pre><code class="language-she">curl --location --request POST 
'http://localhost:7080/mdx/xmla/learn_kylin' \
+--header 'Authorization: Basic QURNSU46S1lMSU4=' \
+--header 'Connection:  Keep-Alive' \
+--header 'SOAPAction: "urn:schemas-microsoft-com:xml-analysis:Execute"' \
+--header 'User-Agent: MSOLAP' \
+--header 'Content-Type: text/xml' \
+--header 'Accept: */*' \
+--header 'Cookie: JSESSIONID=22BF2B6D889F183D7F7E898D4D769398; 
MDXAUTH=ZUt6V1VBRE1JTjoyYTk3Zjg2NTdiNjk0NTE5NzA0NjFiN2ZjYTNkYzg2OToxNjQ2NjMxNDkw'
 \
+--data-raw '&lt;soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
+    &lt;soap:Header&gt;
+        &lt;Session xmlns="urn:schemas-microsoft-com:xml-analysis" 
SessionId="8nblet191q"/&gt;
+    &lt;/soap:Header&gt;
+    &lt;soap:Body&gt;
+        &lt;Execute xmlns="urn:schemas-microsoft-com:xml-analysis"&gt;
+           &lt;Command&gt;
+                &lt;Statement&gt;
+SELECT {[Measures].[Sales volume],
+        [Measures].[Retailer number],
+        [Measures].[Average sales volume of retailers],
+        [Measures].[Proportion in total annual sales volume],
+        [Measures].[YoY growth rate of sales volume],
+        [Measures].[MoM growth rate of sales volume]} 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS , 
+NON EMPTY 
Hierarchize(AddCalculatedMembers({DrilldownLevel({[KYLIN_CAL_DT].[Calendar-Hierarchy].[All]})}))
 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON ROWS  
+FROM [demo0] 
+CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, 
FONT_FLAGS
+                &lt;/Statement&gt;            
+            &lt;/Command&gt;
+            &lt;Properties&gt;
+                &lt;PropertyList&gt;
+                    &lt;Catalog&gt;demo0&lt;/Catalog&gt;
+                    &lt;Timeout&gt;0&lt;/Timeout&gt;
+                    &lt;Content&gt;SchemaData&lt;/Content&gt;
+                    &lt;Format&gt;Multidimensional&lt;/Format&gt;
+                    &lt;AxisFormat&gt;TupleFormat&lt;/AxisFormat&gt;
+                    
&lt;DbpropMsmdFlattened2&gt;false&lt;/DbpropMsmdFlattened2&gt;
+                    &lt;SafetyOptions&gt;2&lt;/SafetyOptions&gt;
+                    &lt;Dialect&gt;MDX&lt;/Dialect&gt;
+                    
&lt;MdxMissingMemberMode&gt;Error&lt;/MdxMissingMemberMode&gt;
+                    
&lt;DbpropMsmdOptimizeResponse&gt;9&lt;/DbpropMsmdOptimizeResponse&gt;
+                    
&lt;DbpropMsmdActivityID&gt;6C94075F-65AD-4B9E-B3EB-4536A191A6AB&lt;/DbpropMsmdActivityID&gt;
+                    
&lt;DbpropMsmdRequestID&gt;9FA20B8A-ACA0-414E-98EA-14649F20CF75&lt;/DbpropMsmdRequestID&gt;
+                    &lt;LocaleIdentifier&gt;1033&lt;/LocaleIdentifier&gt;
+                    
&lt;DbpropMsmdMDXCompatibility&gt;1&lt;/DbpropMsmdMDXCompatibility&gt;
+                &lt;/PropertyList&gt;
+            &lt;/Properties&gt;
+        &lt;/Execute&gt;
+    &lt;/soap:Body&gt;
+&lt;/soap:Envelope&gt;'
+</code></pre>
+
+<h2 id="contact-us">Contact us</h2>
+
+<p>If you want to check the official documentation, please check the manual : 
https://kyligence.github.io/mdx-kylin/en. For developers who want to 
contribute, please check our Github page : 
https://github.com/Kyligence/mdx-kylin .</p>
+
+<p>Feel free to leave your suggestion, ask a question or report a bug by 
referring https://kyligence.github.io/mdx-kylin/en/contact/ .</p>
+
+  </article>
+
+</div>
+
+
+
+
+
+                               </article>
+                       </div>
+               </div>          
+               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<footer id="underfooter">
+    <div>
+        <div class="row">
+            <div class="col-md-12 widget">
+                <div class="widget-body">
+                    <div class="footer-img">
+                        <a href="http://www.apache.org";>
+                            <img id="asf-logo" height="78px" alt="Apache 
Software Foundation" src="/assets/images/apache_footer.png">
+                        </a>
+                    </div>
+                    <p style="padding-top: 11px;">
+                        The contents of this website are © 2015 Apache 
Software Foundation under the terms of the 
+                        <a href="http://www.apache.org/licenses/LICENSE-2.0";> 
Apache License v2 </a>. 
+                    </p>
+                    <p style="margin-bottom: 11px;">    
+                        Apache Kylin and its logo are trademarks of the Apache 
Software Foundation.
+                    </div>
+
+                </div>
+            </div>
+        </div>
+        <!-- /row of widgets -->
+
+    </div>
+    <div></div>
+
+</footer>
+
+       <script src="/assets/js/jquery-1.9.1.min.js"></script> 
+       <script src="/assets/js/bootstrap.min.js"></script> 
+       <script src="/assets/js/main.js"></script>
+       </body>
+</html>
+
+
+
+

Modified: kylin/site/blog/index.html
URL: 
http://svn.apache.org/viewvc/kylin/site/blog/index.html?rev=1899440&r1=1899439&r2=1899440&view=diff
==============================================================================
--- kylin/site/blog/index.html (original)
+++ kylin/site/blog/index.html Thu Mar 31 14:09:40 2022
@@ -197,6 +197,16 @@ var _hmt = _hmt || [];
             
             
             <div class="col-md-6 col-lg-6 col-xs-12">
+              <a class="blog-card" 
href="/blog/2022/03/31/how-to-use-excel-to-query-kylin/">
+                <div class="blog-pic">
+                  <img width="20" src="../assets/images/icon_blog_w.png" />
+                </div>
+                <p class="blog-title">How to use Excel to query Kylin? MDX for 
Kylin!</p>
+                <p align="left" class="post-meta">posted: Mar 31, 2022</p>
+              </a>
+            </div>
+      
+            <div class="col-md-6 col-lg-6 col-xs-12">
               <a class="blog-card" 
href="/blog/2022/03/17/kylin4-now-supporting-aws-glue-catalog/">
                 <div class="blog-pic">
                   <img width="20" src="../assets/images/icon_blog_w.png" />

Modified: kylin/site/cn/blog/index.html
URL: 
http://svn.apache.org/viewvc/kylin/site/cn/blog/index.html?rev=1899440&r1=1899439&r2=1899440&view=diff
==============================================================================
--- kylin/site/cn/blog/index.html (original)
+++ kylin/site/cn/blog/index.html Thu Mar 31 14:09:40 2022
@@ -199,6 +199,16 @@ var _hmt = _hmt || [];
             
             
             <div class="col-md-6 col-lg-6 col-xs-12">
+              <a class="blog-card" 
href="/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/">
+                <div class="blog-pic">
+                  <img width="20" src="/assets/images/icon_blog_w.png" />
+                </div>
+                <p class="blog-title">如何使用 Excel 查询 Kylin?MDX 
for Kylin!</p>
+                <p align="left" class="post-meta">posted: Mar 31, 2022</p>
+              </a>
+            </div>
+      
+            <div class="col-md-6 col-lg-6 col-xs-12">
               <a class="blog-card" 
href="/cn_blog/2022/03/17/kylin4-now-supporting-aws-glue-catalog/">
                 <div class="blog-pic">
                   <img width="20" src="/assets/images/icon_blog_w.png" />

Added: kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html
URL: 
http://svn.apache.org/viewvc/kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html?rev=1899440&view=auto
==============================================================================
--- kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html 
(added)
+++ kylin/site/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/index.html 
Thu Mar 31 14:09:40 2022
@@ -0,0 +1,711 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<!doctype html>
+<html>
+       <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+
+  <title>Apache Kylin | 如何使用 Excel 查询 Kylin?MDX for 
Kylin!</title>
+  <meta name="description" content="Kylin 为什么需要 MDX?">
+  <meta name="author"      content="Apache Kylin">
+  <link rel="shortcut icon" href="fav.png" type="image/png">
+
+
+
+<link rel="stylesheet" href="/assets/css/animate.css">
+<!-- Bootstrap -->
+<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
+
+<!-- Fonts -->
+<!-- <link rel="stylesheet" 
href="http://fonts.googleapis.com/css?family=Alice|Open+Sans:400,300,700"> -->
+
+<!-- Icons -->
+<link rel="stylesheet" href="/assets/css/font-awesome.min.css">
+
+  <!-- Custom styles -->
+  <link rel="stylesheet" href="/assets/css/styles.css">
+  <link rel="stylesheet" href="/assets/css/docs.css">
+  <link rel="stylesheet" href="/assets/css/pygments.css">
+
+  <link rel="canonical" 
href="http://kylin.apache.org/cn_blog/2022/03/31/how-to-use-excel-to-query-kylin/";>
+  <link rel="alternate" type="application/rss+xml" title="Apache Kylin" 
href="http://kylin.apache.org/feed.xml"; />
+
+<!--[if lt IE 9]> <script src="assets/js/html5shiv.js"></script> <![endif]-->
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async 
src="https://www.googletagmanager.com/gtag/js?id=UA-120788561-1";></script>
+<script>
+  window.dataLayer = window.dataLayer || [];
+  function gtag(){dataLayer.push(arguments);}
+  gtag('js', new Date());
+
+  gtag('config', 'UA-120788561-1');
+</script>
+<script type="text/javascript" src="/assets/js/jquery-1.9.1.min.js"></script>
+<script type="text/javascript" src="/assets/js/nside.js"></script> </script>
+<script type="text/javascript" src="/assets/js/nnav.js"></script> </script>
+<script>
+var _hmt = _hmt || [];
+(function() {
+  var hm = document.createElement("script");
+  hm.src = "https://hm.baidu.com/hm.js?bdc5e03add430c0b72cc0eb91eabfa99";;
+  var s = document.getElementsByTagName("script")[0]; 
+  s.parentNode.insertBefore(hm, s);
+})();
+</script>
+
+</head>
+
+       <body>
+               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<header id="header" >
+  
+  <!-- Main Menu -->
+  <nav class="navbar navbar-default" role="navigation" id="nav-wrapper">
+    <div class="container-fluid" id="nav">
+      <!--
+      <img class="img-circle" width="40px" height="40px" id="circlelogo" 
src="/assets/images/kylin_logo.jpg">
+      -->
+      <!-- Brand and toggle get grouped for better mobile display -->
+      <div class="navbar-header">
+        <img class="navbar-logo" width="46" 
src="/assets/images/kylin_logo.png" ></img>
+        <button type="button" class="navbar-toggle collapsed" 
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+          <span class="sr-only">Toggle navigation</span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </button>
+        <ul class="nav icon-navbar">
+            <li><a href="https://twitter.com/apachekylin"; target="_blank" 
class="fa fa-twitter fa-lg"  title="Twitter: @ApacheKylin" ></a></li>
+            <li><a href="https://github.com/apache/kylin"; target="_blank" 
class="fa fa-github-alt fa-lg" title="Github: apache/kylin" ></a></li>
+            <li><a href="https://www.facebook.com/kylinio"; target="_blank" 
class="fa fa-facebook fa-lg" title="Facebook: kylin.io" ></a></li>
+        </ul>
+      </div>
+
+      <!-- Collect the nav links, forms, and other content for toggling -->
+      <div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1">
+
+        <ul class="nav navbar-nav">
+
+          <li><a href="/">Home</a></li>
+          <li>
+            <a href="/docs" class="dropdown-toggle" data-toggle="dropdown" 
role="button" aria-haspopup="true" aria-expanded="false">Docs<span 
class="caret"></span></a>
+            <ul class="dropdown-menu">
+              <li><a href="/docs/">Latest Release(Kylin 4.0.1)</a></li>
+              <li><a href="/docs31/">Kylin 3.1.3</a></li>
+              <li><a href="/docs24/">Kylin 2.4.0</a></li>
+              <li><a href="/archive/">Archive</a></li>
+            </ul>
+          </li>
+          <li><a href="/download">Download</a></li>
+          <li><a href="/community" >Community</a></li>
+          <li>
+            <a href="/development" class="dropdown-toggle" 
data-toggle="dropdown" role="button" aria-haspopup="true" 
aria-expanded="false">Development<span class="caret"></span></a>
+            <ul class="dropdown-menu">
+              <li><a href="/development40/">Kylin 4.x</a></li>
+              <li><a href="/development/">Kylin 3.x And Older Versions</a></li>
+            </ul>
+          </li>
+          <li><a href="/blog">Blog</a></li>
+          <li><a href="/cn" >中文版</a></li> 
+        </ul>     
+      </div><!-- /.navbar-collapse -->
+    </div><!-- /.container-fluid -->
+  </nav>
+
+  <div id="head" class="parallax normal-header" >
+    <div class="text-center header-apache">
+      <a href="http://apache.org/foundation/contributing.html"; title="Support 
Apache" style="margin-left: 150px;">
+        <div>
+          <img src="https://www.apache.org/images/SupportApache-small.png"; >
+        </div>
+      </a>
+    </div>  
+  </div>
+  
+ </header>
+
+               <div class="page-content main">
+                       <header style=" padding:2em 0 0 ">
+                       <div class="container" >
+                         <div style=" padding:0 4em">
+                <div class="blog-icon">
+                  <img width="30" src="/assets/images/icon_blog_w.png">
+                </div>
+                               <h4 class="index-title" style=" 
float:left;"><span>Apache Kylin™ Technical Blog</span></h4>
+                         </div>
+                       </div>
+               </div>
+
+               <div class="container blog">
+                       <div>
+                               <article class="post-content" > 
+                               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<div class="post" style=" padding:2em 4em 4em 4em">
+
+  <header class="post-header">
+    <h1 class="post-title">如何使用 Excel 查询 Kylin?MDX for 
Kylin!</h1>
+    <p class="post-meta" >Mar 31, 2022 • Xiaoxiang Yu</p>
+  </header>
+
+  <article class="post-content" >
+    <h2 id="kylin--mdx">Kylin 为什么需要 MDX?</h2>
+
+<h3 id="section">多维数据库和业务语义层</h3>
+
+<p>多维数据库与关系型数据库的å…
³é”®åŒºåˆ«åœ¨äºŽä¸šåŠ¡è¡¨è¾¾èƒ½åŠ›ã€‚å°½ç®¡ SQL 
表达能力很强,是数据分析师的基本技能,但如果以 
“人人都是分析师” 为目标,SQL 和å…
³ç³»æ•°æ®åº“对非技术人员还是太难了。从非技术人员的视角,数据湖和数据仓库就好似一个黑暗的房间,知道å
…¶ä¸­æœ‰å¾ˆå¤šæ•°æ®ï¼Œå´å› ä¸ºä¸æ‡‚数据库理论和 SQL,无法看清
、理解、和使用这些数据。</p>
+
+<p>如何让数据湖(和数据仓库)对非技术人员也 “<strong>清
澈见底</strong>”?这就需要引入一个对非技术人员更加
友好的“<strong>关系数据模型</strong> – 
<strong>多维数据模型</strong>”。如果说å…
³ç³»æ¨¡åž‹æè¿°äº†æ•°æ®çš„æŠ€æœ¯å½¢æ€ï¼Œé‚£ä¹ˆå¤šç»´æ¨¡åž‹åˆ™æè¿°äº†æ•°æ®çš„业务形态。在多维数据库中,度量对应了每个人都懂的业务指æ
 ‡ï¼Œç»´åº¦åˆ™æ˜¯æ¯”较、观察这些业务指æ 
‡çš„角度。要与上个月比较 KPI,要在平行事业部之é—
 ´æ¯”较绩效,这些是每个非技术人员都理解的概念。通过将å…
³ç³»æ¨¡åž‹æ˜ 
射到多维模型,本质是在技术数据之上增强了业务语义,形成业务语义层,帮助非技术人员也能看懂、探索、使用数据。</p>
+
+<p>为了增强 Kylin 
作为多维数据库的语义层能力,支持多维查询语言是 Kylin 
Roadmap 上的重点内容,比如 MDX 和 DAX。通过 MDX 可以将 Kylin 
中的数据模型转换为业务友好的语言,赋予数据业务价值,方便对接
 <strong>Excel</strong>、Tableau 等 BI 工具进行多维分析。</p>
+
+<h3 id="mdx-">基于 MDX 打造业务指标平台</h3>
+
+<p>使用 MDX 来创建复杂的业务指标,相对 SQL 
的一些特点和优势如下:</p>
+
+<ol>
+  <li>更好的<strong>支持复杂分析场景</strong>,如半累加
、多对多、时间窗口分析等;</li>
+  <li>广泛支持各种 BI,“Kylin + MDX” 不仅能够通过 SQL 
接口暴露为类似于关系型数据库的表,也可以暴露为兼容 
XMLA 协议的带有语义信息的数据源,可通过 MDX 
语言进行查询,支持对接 <strong>Excel</strong> 等只能通过 XMLA 
协议对接数据源的 BI;</li>
+  <li>基于 Kylin 中的数据模型灵活定义 MDX 
语义模型,将底层数据结构转换为业务友好的语言,赋予数据业务价值,使得业务人员在分析时æ—
 éœ€å…³å¿ƒåº•层的技术复杂度和实现;通过 MDX 
模型向外暴露统一语义,帮助用户<strong>构建统一的业务语义层</strong>。(详细信息可以参考链接
 1/6/7)</li>
+</ol>
+
+<h2 id="mdx--1">MDX 介绍</h2>
+
+<h3 id="mdx">什么是 MDX?</h3>
+
+<p>MDX (Multi Dimensional eXpression) 是一种 OLAP 
多维数据集的查询语言,最初由 Microsoft 于 1997 年作为 OLEDB 
for OLAP 规范引入,随后集成在 SSAS 中。目前,MDX 在 OLAP 
数据库中被广泛采用。</p>
+
+<p>MDX 在很多方面与结构化查询语言 (SQL) 
语法相似,但它不是 SQL 语言的扩展;事实上,MDX 
所提供的一些功能也可由 SQL 
提供,尽管不是那么有效或直观。如同 SQL 查询一样,MDX 
查询可以包括SELECT 子句)、FROM 子句和 WHERE 子句。这些å…
³é”®å­—以及其它关键字提供了各种工å…
·ï¼Œç”¨æ¥ä»Žå¤šç»´æ•°æ®é›†æžå–数据的特定部分。</p>
+
+<p>MDX 查询语法示例如下(详细信息可以参考链接 3):</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code><span 
class="k">select</span> <span class="o">&lt;</span><span 
class="n">axis_specification</span><span class="o">&gt;</span><span 
class="p">[,</span> <span class="o">&lt;</span><span 
class="n">axis_specification</span><span class="o">&gt;</span><span 
class="p">]</span>
+<span class="k">from</span> <span class="o">&lt;</span><span 
class="n">cube_specification</span><span class="o">&gt;</span>
+<span class="k">where</span> <span class="o">&lt;</span><span 
class="n">slicer_specification</span><span class="o">&gt;</span>
+</code></pre>
+</div>
+
+<h3 id="mdx--2">MDX 基本概念</h3>
+
+<p>在了解学习 MDX 之前,请至少掌握以下概念。限于相å…
³æ¦‚念在 Microsoft 的 SSAS 
官网有比较详细的介绍,不了解的同学可以通过文章
末尾的参考链接学习。(详细信息可以参考链接 2/3/4)</p>
+
+<ol>
+  
<li>维度(Dimensions)、级别(Levels)、成员(Members)和度量值(Measures)</li>
+  <li>单元(Cell)、元组(Tuple)和集合(Set)</li>
+  <li>轴维度(Query Axis)和切片器维度(Slicer Axis)</li>
+</ol>
+
+<h3 id="mdx--sql-">MDX 和 SQL 的比较</h3>
+
+<p><strong>查询对象</strong>不同,MDX 
的查询对象是<strong>多维数据集</strong>(Cube),是提前 Join 
和聚合好的数据,查询时不需要指定 Join 关系。SQL 
查询对象是<strong>å…
³ç³»è¡¨</strong>(Table),是一条条的明细记录,查询时需要指定表之间的
 Join 关系。</p>
+
+<p><strong>查询结果</strong>不同,SQL 
返回<strong>二维数据子集</strong>,而 MDX 
返回<strong>多维数据集</strong>。(详细信息可以参考链接 5)</p>
+
+<h1 id="mdx-for-kylin-">MDX for Kylin 介绍</h1>
+
+<h3 id="mdx-for-kylin--1">什么是 MDX for Kylin ?</h3>
+
+<p><strong>MDX for Kylin</strong> 是基于 <strong>Mondrian</strong> 
二次开发的,由 <strong>Kyligence</strong> 贡献的,使用 
<strong>Apache Kylin 4</strong> 作为数据源的 MDX 查询引擎 。MDX for 
Kylin 的使用体验比较接近 Microsoft 
SSAS,可以集成多种数据分析工具,包括 Microsoft Excel、Tableau 
等,可以为大数据分析场景下提供更极致的体验。</p>
+
+<h3 id="mdx-for-kylin--2">MDX for Kylin 创建业务指标</h3>
+
+<h4 id="section-1">原子指标和业务指标</h4>
+
+<p>在 Kylin Cube 
我们创建的各种度量,是在单独的一列上的进行的聚合计算(TopN
 除外),只包含了有限的几种聚合函数,即 
Sum/Max/Min/Count/Count 
Distinct,相对比较简单,我们称之为<strong>原子指æ 
‡</strong>。</p>
+
+<p>在实际业务场景中,基于原子指æ 
‡æˆ‘们可以对<strong>原子指æ 
‡</strong>的各种复杂运算,来创建有业务含义的复合指æ 
‡ï¼Œè¿™æ ·çš„æŒ‡æ ‡æˆ‘们称之为<strong>业务指标。</strong></p>
+
+<h4 id="section-2">层级结构、计算度量和命名集</h4>
+
+<p><strong>层级结构:</strong>层级结构是基于维度的级别集合,可用于提高数据分析人员的分析能力。例如,ä½
 å¯ä»¥åˆ›å»ºä¸€ä¸ªæ—¶é—´å±‚级结构,包
含了年、季、月、周和日级别。这æ 
·åˆ†æžäººå‘˜åœ¨å®¢æˆ·ç«¯ä¸­å¯ä»¥å…
ˆé€å¹´åˆ†æžé”€å”®é¢ï¼Œåœ¨éœ€è¦æ—¶å¯ä»¥åˆ†åˆ«å±•开“季度 &gt; 月 &gt; 
周 &gt; 日”来进行更细粒度的分析。</p>
+
+<p><strong>计算度量:</strong>计算度量是对<strong>原子指æ 
‡</strong>使用 MDX 表达式进行复合计算形成的新的度量/指æ 
‡ï¼Œæˆ‘们主要使用计算度量来创建<strong>业务指标</strong>。</p>
+
+<p><strong>命名集:</strong>在 MDX for Kylin 
的使用中,经常会出现需要重复使用一组成员的需求,这种需求可以通过定义命名集来满足。命名集(NamedSet)
 是根据指定的表达式 
计算得到的一个成员Set,即一组成员的集合,命名集可以直接置于轴上用于展示,也可以在计算度量或å
…¶ä»–命名集的表达式中使用。</p>
+
+<h4 id="section-3">创建语义模型</h4>
+
+<p>在 Kylin 4 根据表与表之间的关系创建数据模型,并且在 
Cube 
上定义维度和度量,这些度量我们可以认为是<strong>原子指æ 
‡</strong>。</p>
+
+<p>在 MDX for Kylin,将相关联的 Kylin Cube 相å…
³è”,来创建数据集;并且基于原子指æ 
‡ï¼Œæ¥åˆ›å»ºæœ‰ä¸šåŠ¡å«ä¹‰çš„<strong>业务指标。</strong></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/1_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h4 id="section-4">数据分析</h4>
+
+<p>使用时,客户端发送 MDX 查询给 MDX for Kylin,MDX for Kylin 
再解析 MDX 查询翻译为 SQL 并且发送给 Kylin ,然后 Kylin 
通过预计算的 Cuboid 回答 SQL 查询并把结果交还给 MDX for 
Kylin,MDX for Kylin 会再做一些衍生指æ 
‡çš„计算,最终将多维数据结果返回给客户端。</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/2_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h4 id="section-5">流程总结</h4>
+
+<p>总的来说,支持 MDX 接口能够增强 Kylin 
的语义层能力,为用户带来统一的数据分析和管理体验,更好地发挥数据的价值。下图就是将从下而上,展示从原始数据åŠ
 å·¥ä¸šåŠ¡æŒ‡æ ‡çš„è¿‡ç¨‹ã€‚</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/3_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h3 id="mdx-for-kylin--3">MDX for Kylin 的技术优势</h3>
+
+<p>MDX for Kylin 相对其它开源 MDX 查询引擎,å…
·æœ‰ä»¥ä¸‹ä¼˜åŠ¿ï¼š</p>
+
+<ul>
+  <li>更好支持BI(Excel/Tableau/Power BI等) 产品,适配 XMLA 
协议;</li>
+  <li>针对 BI 的 MDX Query 进行了特定优化重写;</li>
+  <li>适配 Kylin 查询,通过 Kylin 的预计算能力加速 MDX 
查询;</li>
+  <li>通过简洁易懂的操作界面,提供了统一的指æ 
‡å®šä¹‰å’Œç®¡ç†èƒ½åŠ›ã€‚</li>
+</ul>
+
+<h1 id="docker-">从 Docker 快速开始</h1>
+
+<h3 id="section-6">测试环境</h3>
+
+<ul>
+  <li>Macbook Pro 笔记本
+    <ul>
+      <li>Docker Desktop (latest version)</li>
+    </ul>
+  </li>
+  <li>Windows 10 虚拟机
+    <ul>
+      <li>Microsoft Excel (for Windows)</li>
+    </ul>
+  </li>
+</ul>
+
+<h3 id="section-7">启动容器</h3>
+
+<p>这个容器包含了 Yarn、HDFS、MySQL、Kylin、MDX for Kylin 
等进程。</p>
+
+<pre><code class="language-she">docker run -d \
+    -m 8g \
+    -p 7070:7070 \
+    -p 7080:7080 \
+    -p 8088:8088 \
+    -p 50070:50070 \
+    -p 8032:8032 \
+    -p 8042:8042 \
+    -p 2181:2181 \
+    --name kylin-4.0.1 \
+    apachekylin/apache-kylin-standalone:kylin-4.0.1-mondrian
+</code></pre>
+
+<h3 id="section-8">检查环境</h3>
+
+<p>等待一段时间,请依次检查 HDFS/YARN/Kylin/MDX for Kylin 的 Web 
UI 是否可以访问。</p>
+
+<table>
+  <thead>
+    <tr>
+      <th><strong>组件</strong></th>
+      <th><strong>Web UI 地址</strong></th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>HDFS</td>
+      <td>http://localhost:50070/dfshealth.html</td>
+    </tr>
+    <tr>
+      <td>YARN</td>
+      <td>http://localhost:8088/cluster</td>
+    </tr>
+    <tr>
+      <td>Kylin</td>
+      <td>http://localhost:7070/kylin</td>
+    </tr>
+    <tr>
+      <td>MDX for Kylin</td>
+      <td>http://localhost:7080/overview</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="cube">构建样例 Cube</h3>
+
+<p>请直接使用 Kylin 自带的样例 Cube:<code 
class="highlighter-rouge">kylin_sales_cube</code>。</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/4_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h3 id="mdx--3">创建 MDX 数据集</h3>
+
+<h5 id="mdx-for-kylin">登录 MDX for Kylin</h5>
+
+<p>默认账号/密码是 ADMIN/KYLIN,MDX for Kylin 的账户与 KYLIN 
的同步。</p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/5_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h5 id="section-9">创建数据集和定义关系</h5>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/6_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/7_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h5 id="section-10">创建时间层级</h5>
+
+<ul>
+  <li>修改<code 
class="highlighter-rouge">KYLIN_CAL_DT</code>的表属性</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/8_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>修改 <code class="highlighter-rouge">YEAR_BEG_DT</code> 
的类型为“年”</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/9_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/10_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>同理修改<code class="highlighter-rouge">MONTH_BEG_DT</code>和<code 
class="highlighter-rouge">WEEK_BEG_DT</code> ,并且选择对应的层级</li>
+  <li>创建时间层级<code class="highlighter-rouge">Calendar</code> 
,请注意设置层级结构的前后顺序保持为“年-月-周”</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/11_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h5 id="section-11">修改原子指标名称</h5>
+
+<ul>
+  <li>修改 <code class="highlighter-rouge">GMV_SUM</code> 为 
“销售额”,修改<code 
class="highlighter-rouge">SELLER_CNT_HLL</code>为“商家数量”</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/12_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h5 id="section-12">创建业务指标(计算度量)</h5>
+
+<ul>
+  <li>创建业务指标“商户平均消费额”</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/13_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>依次创建业务指æ 
‡â€œé”€å”®é¢å¹´åŒæœŸå¢žé•¿çŽ‡â€å’Œâ€œé”€å”®é¢æœˆåŒæœŸå¢žé•¿çŽ‡â€</li>
+</ul>
+
+<table>
+  <thead>
+    <tr>
+      <th><strong>指标名称</strong></th>
+      <th><strong>MDX 表达式</strong></th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>商户平均消费额</td>
+      <td>[Measures].[销售额]/[Measures].[商家数量]</td>
+    </tr>
+    <tr>
+      <td>销售额年同期增长率</td>
+      <td>[Measures].[销售额] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[YEAR_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[销售额] ) 
- 1</td>
+    </tr>
+    <tr>
+      <td>销售额月同期增长率</td>
+      <td>[Measures].[销售额] / SUM(  ParallelPeriod(    
[KYLIN_CAL_DT].[Calendar-Hierarchy].[MONTH_BEG_DT],    1,    
[KYLIN_CAL_DT].[Calendar-Hierarchy].CurrentMember  ),  [Measures].[销售额] ) 
- 1</td>
+    </tr>
+    <tr>
+      <td>总销售额</td>
+      <td>Fixed([KYLIN_CAL_DT].[YEAR_BEG_DT], [Measures].[销售额])</td>
+    </tr>
+    <tr>
+      <td>全年销售额占比</td>
+      <td>[Measures].[销售额]/[Measures].[总销售额]</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="http-api--mdx-">HTTP API 测试 MDX 查询</h3>
+
+<p>如果你没有 一个 Windows 环境的 Excel,并且你想测试你
在上一步测试创建的业务指标,请通过  MDX 暴露的查询相å…
³çš„ REST API 来验证查询结果。如果想修改 MDX 
查询语句,请修改以下<code 
class="highlighter-rouge">&lt;Statement&gt;&lt;/Statement&gt;</code> 里面的 
MDX 语句,并且请根据情况修改<code 
class="highlighter-rouge">Catalog</code>字段的值。</p>
+
+<pre><code class="language-she">curl --location --request POST 
'http://localhost:7080/mdx/xmla/learn_kylin' \
+--header 'Authorization: Basic QURNSU46S1lMSU4=' \
+--header 'Connection:  Keep-Alive' \
+--header 'SOAPAction: "urn:schemas-microsoft-com:xml-analysis:Execute"' \
+--header 'User-Agent: MSOLAP' \
+--header 'Content-Type: text/xml' \
+--header 'Accept: */*' \
+--header 'Cookie: JSESSIONID=22BF2B6D889F183D7F7E898D4D769398; 
MDXAUTH=ZUt6V1VBRE1JTjoyYTk3Zjg2NTdiNjk0NTE5NzA0NjFiN2ZjYTNkYzg2OToxNjQ2NjMxNDkw'
 \
+--data-raw '&lt;soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
+    &lt;soap:Header&gt;
+        &lt;Session xmlns="urn:schemas-microsoft-com:xml-analysis" 
SessionId="8nblet191q"/&gt;
+    &lt;/soap:Header&gt;
+    &lt;soap:Body&gt;
+        &lt;Execute xmlns="urn:schemas-microsoft-com:xml-analysis"&gt;
+           &lt;Command&gt;
+                &lt;Statement&gt;
+SELECT {[Measures].[销售额],
+        [Measures].[商家数量],
+        [Measures].[商户平均消费额],
+        [Measures].[全年销售额占比],
+        [Measures].[销售额年同期增长率],
+        [Measures].[销售额月同期增长率]} 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS , 
+NON EMPTY 
Hierarchize(AddCalculatedMembers({DrilldownLevel({[KYLIN_CAL_DT].[Calendar-Hierarchy].[All]})}))
 
+    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON ROWS  
+FROM [demo0] 
+CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, 
FONT_FLAGS
+                &lt;/Statement&gt;            
+            &lt;/Command&gt;
+            &lt;Properties&gt;
+                &lt;PropertyList&gt;
+                    &lt;Catalog&gt;demo0&lt;/Catalog&gt;
+                    &lt;Timeout&gt;0&lt;/Timeout&gt;
+                    &lt;Content&gt;SchemaData&lt;/Content&gt;
+                    &lt;Format&gt;Multidimensional&lt;/Format&gt;
+                    &lt;AxisFormat&gt;TupleFormat&lt;/AxisFormat&gt;
+                    
&lt;DbpropMsmdFlattened2&gt;false&lt;/DbpropMsmdFlattened2&gt;
+                    &lt;SafetyOptions&gt;2&lt;/SafetyOptions&gt;
+                    &lt;Dialect&gt;MDX&lt;/Dialect&gt;
+                    
&lt;MdxMissingMemberMode&gt;Error&lt;/MdxMissingMemberMode&gt;
+                    
&lt;DbpropMsmdOptimizeResponse&gt;9&lt;/DbpropMsmdOptimizeResponse&gt;
+                    
&lt;DbpropMsmdActivityID&gt;6C94075F-65AD-4B9E-B3EB-4536A191A6AB&lt;/DbpropMsmdActivityID&gt;
+                    
&lt;DbpropMsmdRequestID&gt;9FA20B8A-ACA0-414E-98EA-14649F20CF75&lt;/DbpropMsmdRequestID&gt;
+                    &lt;LocaleIdentifier&gt;1033&lt;/LocaleIdentifier&gt;
+                    
&lt;DbpropMsmdMDXCompatibility&gt;1&lt;/DbpropMsmdMDXCompatibility&gt;
+                &lt;/PropertyList&gt;
+            &lt;/Properties&gt;
+        &lt;/Execute&gt;
+    &lt;/soap:Body&gt;
+&lt;/soap:Envelope&gt;'
+</code></pre>
+
+<h3 id="excel-">通过 Excel 透视表访问业务指标</h3>
+
+<h5 id="mdx-for-kylin-1">连接 MDX for Kylin</h5>
+
+<ul>
+  <li>打开 Microsoft Excel (for Windows)</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/14_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>配置 MDX for Kylin 地址,请替换 IP_Adress 为你笔记本的 IP 
地址,用户名和密码使用 Kylin 的账号和密码。</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/15_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h5 id="section-13">通过数据透视表分析销售额</h5>
+
+<ul>
+  <li>配置数据透视表</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/16_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>查看年同期销售额增长率</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/17_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<ul>
+  <li>查看月同期销售额增长率</li>
+</ul>
+
+<p><img 
src="/images/blog/how_to_use_excel_to_query_kylin/18_use_excel_to_query_kylin.cn.png"
 alt="" /></p>
+
+<h2 id="section-14">参考链接</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th><strong>编号</strong></th>
+      <th><strong>链接</strong></th>
+      <th><strong>注释</strong></th>
+      <th><strong>产品</strong></th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>1</td>
+      <td>https://lists.apache.org/thread/4fkhyw1fyf0jg5cb18v7vxyqbn6vm3zv</td>
+      <td>Kylin 社区发起开发语义层的讨论</td>
+      <td>Apache Kylin</td>
+    </tr>
+    <tr>
+      <td>2</td>
+      <td>https://mondrian.pentaho.com/documentation/mdx.php</td>
+      <td>Mondrian 的官网文档</td>
+      <td>Mondrian</td>
+    </tr>
+    <tr>
+      <td>3</td>
+      <td>https://docs.microsoft.com/en-us/sql/mdx/mdx-syntax-elements-mdx</td>
+      <td>SSAS 关于 MDX 查询的语法规范</td>
+      <td>Microsoft SSAS</td>
+    </tr>
+    <tr>
+      <td>4</td>
+      
<td>https://wiki.smartbi.com.cn/pages/viewpage.action?pageId=76692713</td>
+      <td>SmartBI 关于 MDX 基本概念的介绍</td>
+      <td>SmartBI</td>
+    </tr>
+    <tr>
+      <td>5</td>
+      
<td>https://dba.stackexchange.com/questions/138311/good-example-of-mdx-vs-sql-for-analytical-queries</td>
+      <td>对比 SQL 和 MDX</td>
+      <td>N/A</td>
+    </tr>
+    <tr>
+      <td>6</td>
+      <td>https://kyligence.io/blog/opportunities-for-ssas-in-the-cloud/</td>
+      <td>Kyligence MDX 技术博客</td>
+      <td>Kyligence</td>
+    </tr>
+    <tr>
+      <td>7</td>
+      
<td>https://kyligence.io/blog/semantic-layer-the-bi-trend-you-dont-want-to-miss-in-2020/</td>
+      <td>Kyligence MDX 技术博客</td>
+      <td>Kyligence</td>
+    </tr>
+    <tr>
+      <td>8</td>
+      <td>https://docs.kyligence.io/books/mdx/v1.3/zh-cn/index.html</td>
+      <td>Kyligence MDX 用户手册</td>
+      <td>Kyligence</td>
+    </tr>
+    <tr>
+      <td>9</td>
+      
<td>https://medium.com/airbnb-engineering/how-airbnb-achieved-metric-consistency-at-scale-f23cc53dea70</td>
+      <td>Airbnb Tech Blog</td>
+      <td>Airbnb Minerva</td>
+    </tr>
+  </tbody>
+</table>
+
+
+  </article>
+
+</div>
+
+
+
+
+
+                               </article>
+                       </div>
+               </div>          
+               <!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<footer id="underfooter">
+    <div>
+        <div class="row">
+            <div class="col-md-12 widget">
+                <div class="widget-body">
+                    <div class="footer-img">
+                        <a href="http://www.apache.org";>
+                            <img id="asf-logo" height="78px" alt="Apache 
Software Foundation" src="/assets/images/apache_footer.png">
+                        </a>
+                    </div>
+                    <p style="padding-top: 11px;">
+                        The contents of this website are © 2015 Apache 
Software Foundation under the terms of the 
+                        <a href="http://www.apache.org/licenses/LICENSE-2.0";> 
Apache License v2 </a>. 
+                    </p>
+                    <p style="margin-bottom: 11px;">    
+                        Apache Kylin and its logo are trademarks of the Apache 
Software Foundation.
+                    </div>
+
+                </div>
+            </div>
+        </div>
+        <!-- /row of widgets -->
+
+    </div>
+    <div></div>
+
+</footer>
+
+       <script src="/assets/js/jquery-1.9.1.min.js"></script> 
+       <script src="/assets/js/bootstrap.min.js"></script> 
+       <script src="/assets/js/main.js"></script>
+       </body>
+</html>
+
+
+
+


Reply via email to