MDX : Non Empty v/s NonEmpty
MDX : Non Empty v/s NonEmpty |
User Rating: / 50
PoorBest
Written by Jason Thomas | |||
Friday, 07 May 2010 00:44 | |||
Reposted from Jason Thomas blog with the author's permission. The last few months, recession worries have allayed and it is common to see the Talent Acquisition guys of our company stalking us techies to take interviews for lateral hires at odd hours. Now spending a beautiful Saturday morning + afternoon taking interviews is not my cup of tea but then their persistence paid off and finally I agreed to come for taking the interviews. That is when I thought of giving my readers a sneak peek of my list of interview questions, one by one per post. One of my favourite questions in MDX is the difference between Non Empty and NonEmpty because even though many people use them daily to remove NULLS from their queries, very few understand the working behind it. Many times, I have even got answers like “there is a space between Non and Empty, that is the difference”. The objective of this post is to clearly differentiate between the two. Let us say my initial query is SELECT This will give the following output NON EMPTY Non Empty is prefixed before the sets defining the axes and is used for removing NULLs. Let us see what happens when we add Non Empty on the Rows axis. SELECT The output is shown below You will notice that Chile (CL) has been filtered out while rows like UK, Canada, etc are still there even if they have NULLs for some of the measures. In short, only the rows having NULL for all the members of the set defined in the column axis is filtered out. This is because the Non Empty operator works on the top level of the query. Internally, the sets defined for the axes are generated first and then the tuples having NULL values are removed. Now that we know how NON EMPTY works, it shouldn’t be hard for us to tell the output of the below query SELECT The output is shown below NONEMPTY() The NonEmpty() returns the set of tuples that are not empty from a specified set, based on the cross product of the specified set with a second set. Suppose we want to see all the measures related to countries which have a non-null value for Subscribers SELECT This will give the following output As you can see, the NonEmpty operator takes all the rows having a not NULL value for Subscribers in the rows and then displays all the measures defined in the column axis. Basically what happens internally is that NonEmpty is evaluated when the sets defining the axis are evaluated. So at this point of time, there is no context of the other axes. What I said now can be better understood from the following example Now, we write the below query SELECT Output is given below Think for a while and predict which all rows would be returned when the NonEmpty operator is applied on the rows SELECT If you guessed just IN, US, GB and AU, please go back and read once again. If you replied All rows except Chile, full marks to you, you have been an attentive reader. The reason is because NonEmpty is evaluated when the set defining the axis is evaluated (here, Country) and at that point of time, NonEmpty is evaluated for each member of the country against the default member of the Date dimension (which would be ALL generally). As you can see, we already have values for CA and AP for other months and hence they will not be filtered out. Optimizing Non Empty by using NonEmpty Ok, now you know how Non Empty and NonEmpty works internally and we can apply this knowledge to optimize our queries. Suppose there is a complex logic in our axes like finding all the countries that have 30 or more hits in any month. The query is given below SELECT Now my time dimension will have 10 years of data, which means around 120 (10*12) members for the month attribute and my country attribute may have let’s say, 100 members. Now even though I just have 3 months of data for 10 countries for hits, the filter function will need to go through all the combinations of country and month (120*100 combinations). Instead of that, we can just use the NonEmpty operator and bring down the combinations to less than 30 (3 months*10 countries) by using the below query SELECT
|
If you are speaking of the image with mouseover as Nonempty second example, I am actually considering it as the source for my queries below.
For example, the last "NON EMPTY" example query and results were not explained, and do not make sense. ie: "spam" column not shown and "Chile" is shown but empty, but these results not explained. As a student of ssas and mdx, based on the author's explanation provided I would be lead to believe a different result would have happened.
As a student of the software, my interest as been piqued and I'll investigate further.
MDX : Non Empty v/s NonEmpty的更多相关文章
- NonEmpty和Non Empty的区别[转]
One of my favourite questions in MDX is the difference between Non Empty and NonEmpty because even t ...
- 【转载】NonEmpty和Non Empty的区别
转载来源:http://www.ssas-info.com/analysis-services-articles/50-mdx/2196-mdx-non-empty-vs-nonempty One o ...
- XVII Open Cup named after E.V. Pankratiev. GP of Moscow Workshops
A. Centroid Tree 枚举至多两个重心作为根,检查对于每个点是否都满足$2size[x]\leq size[father[x]]$即可. #include<stdio.h> # ...
- empty、isset、is_null的比较
直接上代码 <?php $a=0; $b='0'; $c=0.0; $d=''; $e=NULL; $f=array(); $g='\0'; $h=' ';//space $i=true; $j ...
- empty、isset、is
直接上代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <?php $a=0; $b='0'; $c=0.0; ...
- 【转】Go Interface 源码剖析
源网址:http://legendtkl.com/2017/07/01/golang-interface-implement/ 0.引言 在上一篇文章 <深入理解 Go Interface> ...
- Codeforces 797C - Minimal string
C. Minimal string 题目链接:http://codeforces.com/problemset/problem/797/C time limit per test 1 second m ...
- golang interface判断为空nil
要判断interface 空的问题,首先看下其底层实现. interface 底层结构 根据 interface 是否包含有 method,底层实现上用两种 struct 来表示:iface 和 ef ...
- 【PAT】1053 Path of Equal Weight(30 分)
1053 Path of Equal Weight(30 分) Given a non-empty tree with root R, and with weight Wi assigned t ...
随机推荐
- Transact-SQL三值逻辑
/*===========================<一>========================== 在SQL中逻辑表达式的值有三种: 1.TRUE 2.FALSE 3.U ...
- 小白日记46:kali渗透测试之Web渗透-SqlMap自动注入(四)-sqlmap参数详解- Enumeration,Brute force,UDF injection,File system,OS,Windows Registry,General,Miscellaneous
sqlmap自动注入 Enumeration[数据枚举] --privileges -U username[CU 当前账号] -D dvwa -T users -C user --columns [ ...
- 使用docker-hub
使用docker hub 需要其账号 基本操作 查找镜像 sudo docker search centos 每个用户有自己的命名空间,如:centos是存仓库中的镜像文件,admln/centos则 ...
- 集成支付宝钱包支付ios SDK的方法和经验
没想到,支付宝的SDK是我目前用过的所有第三方SDK中最难用的一个了. 下载 首先,你要想找到这个SDK,都得费点功夫.现在的SDK改名叫移动支付集成开发包了,下载页面在 这里 的 “请点此下载集成开 ...
- 解决Intellij IDEA 通过archetype创建Maven项目缓慢的问题
1.由于默认情况下,根据archetype创建maven项目会从网络下载catalog文件,导致创建maven项目缓慢 Searching for remote catalog: http://rep ...
- 【Linux/Ubuntu学习5】Ubuntu 下android 开发,eclipse不能识别手机
ubuntu下eclipse不能识别手机解决方法: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1) 在终端运行 lsusb 会发现结果 ...
- Java Script基础(八) Array数组对象
一.Array数组 JavaScript中的数组也是具有相同数据类型的一个或者多个值得集合.用法和Java中的数组类似. Array对象的常用属性和方法: 属性: length:获取数组的长度: 方法 ...
- VMware系统运维(八)vCenter Server安装
1.终于开始安装vCenter Server了,需要配置数据源哦! 2.下一步 3.接受协议,下一步 4.输入许可密钥,也可以后面再输入,下一步 5.选择数据源,即我们前面配置的系统DSN,下一步 6 ...
- JdbcTemplate 、NamedParameterJdbcTemplate、SimpleJdbcTemplate的区别
一.JdbcTemplate 首先在配置文件中设置数据源 <bean id="dataSource" class="org.springframework.jdbc ...
- 转: https 单向双向认证说明_数字证书, 数字签名, SSL(TLS) , SASL
转自: http://www.cnblogs.com/mailingfeng/archive/2012/07/18/2597392.html 因为项目中要用到TLS + SASL 来做安全认证层. 所 ...