添加链接
注册
登录
link之家
链接快照平台
输入网页链接,自动生成快照
标签化管理网页链接
相关文章推荐
腼腆的卡布奇诺
·
Data Types - Tableau
·
3 周前
·
道上混的滑板
·
关于python实现CRC32的应用和总结_ ...
·
1 月前
·
自信的抽屉
·
MultipartFile会不会导致内存泄露 ...
·
1 年前
·
机灵的鸵鸟
·
ChatGPT是“虚火”还是颠覆性技术革命? ...
·
1 年前
·
有情有义的蟠桃
·
NEWSEQUENTIALID ...
·
1 年前
·
失恋的柿子
·
DBeaver for ...
·
1 年前
·
link之家
›
合并数据 - Tableau
tableau
https://help.tableau.com/current/pro/desktop/zh-cn/union.htm
爱旅游的伤疤
1 年前
</noscript><div id="app" class="wrapper"><header id="tableau-help-article-header" class="container--full-width quick-help-header"><div class="container--centered"><div class="header__back-button"><back-button title="Go back"/></div><div class="header__mobile-menu quick-help-hidden"><menu-tree-toggle/></div><div class="header__logo quick-help-hidden"><a href="https://www.tableau.com/zh-cn/"><img src="./Resources/tableau-logo.png" class="header__logo__img" alt="Tableau"/></a></div><div class="header__search"><search-header-help placeholder="搜索"/></div><div class="header__home-button"><home-button title="Go home"/></div></div></header><div class="container--navigation-top quick-help-hidden content-only-hidden"><div id="help-subheader" class="subheader print-hidden"><div class="container--centered"><h4 class="heading--subheader">Tableau Desktop 和 Web 制作帮助</h4></div></div><div class="container--top-links"><div class="container--centered container--breadcrumbs"><div><breadcrumb-links-help/></div></div><div id="help-container-menu-headings" class="container--menu-headings"><nav class="nav-medium-screen"><menu-heading-links-static-help menu-title="本文内容" :disabled="false" :headings="pageHeadings"/></nav></div></div></div><div class="section--main container--full-width"><div class="container--centered"><nav class="nav-side nav-side--left" role="navigation"><menu-tree-help menu-title="内容"/></nav><article role="main"><h1 id="contentH1"/><div class="caption article__tags content-only-hidden quick-help-hidden"><span class="article__tags--applies-to">适用于: Cloud, Desktop, Server</span><br/><span class="article__tags--role"> </span></div><div id="content-body"> <div role="main" id="mc-main-content"><p>您可以合并您的数据,通过将值(行)从一个表附加到另一个表来合并两个或更多表。若要合并 Tableau 数据源中的数据,表必须来自同一连接。</p><h2 is="heading-item" :level="2" id="支持的连接器">支持的连接器</h2><p>如果您的数据源支持合并,在连接到数据之后,<span class="uicontrol">“新建并集”</span>选项将显示在数据源页面的左侧窗格中。支持的连接器可能因 <span class="VariablesTabsProductDesktop">Tableau Desktop</span> 和 <span class="VariablesTabsProductServer">Tableau Server</span> 以及 <span class="VariablesTabsProductOnline">Tableau Cloud</span> 而异。</p><p><img src="Img/union_new_union.png" alt=""/></p><p>为了获得最佳结果,您使用并集合并的表必须具有相同的结构。即,每个表必须具有相同的字段数,并且相关字段必须具有匹配的字段名称和数据类型。</p><p>例如,假设您在按月分开的三个表中存储了以下客户采购信息。表名称为“May2016”、"June2016”、和July2016”。</p><table><tbody><tr><td><p><b>May2016</b></p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">客户</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1">类型</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">Lane</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">5</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">10</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">Chris</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">6</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #ffdab9;">28</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #ffdab9;">Juan</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #ffdab9;">1</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr></tbody></table></td><td><p><b>June2016</b></p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">客户</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1">类型</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">Lisa</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">3</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b0e0e6;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">Isaac</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">4</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b0e0e6;">现金</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #b0e0e6;">28</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #b0e0e6;">Sam</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #b0e0e6;">2</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1" style="background-color: #b0e0e6;">贷记</td></tr></tbody></table></td><td><p><b>July2016</b></p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">客户</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1">类型</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">Mario</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">2</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #dcdcdc;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">15</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">Wei</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">1</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #dcdcdc;">现金</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">21</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">Jim</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">7</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1" style="background-color: #dcdcdc;">现金</td></tr></tbody></table></td></tr></tbody></table><p>这些表的并集会创建以下单个表,其中包含所有表中的所有行。</p><p><b>并集</b></p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">客户</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1">类型</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">Lane</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">5</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">10</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">Chris</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">6</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">Juan</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #ffdab9;">1</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #ffdab9;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">Lisa</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">3</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b0e0e6;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">Isaac</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">4</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b0e0e6;">现金</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">Sam</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b0e0e6;">2</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b0e0e6;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">Mario</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">2</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #dcdcdc;">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">15</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">Wei</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #dcdcdc;">1</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #dcdcdc;">现金</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">21</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">Jim</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #dcdcdc;">7</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1" style="background-color: #dcdcdc;">现金</td></tr></tbody></table><h2 is="heading-item" :level="2" id="手动合并表"><a name="union_manually"/>手动合并表</h2><p>使用此方法来手动合并不同的表。此方法允许您将单独的表从“数据源”页面的左侧窗格拖放到“并集”对话框中。</p><h3 is="heading-item" :level="3" id="手动合并表1">手动合并表</h3><ol><li value="1"><p>在数据源页面上,双击<span class="uicontrol">“新建并集”</span>以设置并集。</p><p><img src="Img/union_union_new.png" alt=""/></p></li><li value="2"><p>从左侧窗格中将表拖到“并集”对话框中。</p><p><img src="Img/union_union_firsttable.png" alt=""/></p></li><li value="3"><p>从左侧窗格中选择另一个表并将其拖到第一个表的正下方。</p><p><img src="Img/union_union_multipletables.png" alt=""/></p><p class="note"><b>提示:</b>若要同时向并集中添加多个表,请按 <strong>Shift</strong> 或 <b>Ctrl</b>(在 Mac 上按 <strong>Shift</strong> 或 <b>Command</b>),在左侧窗格中选择想要合并的表,然后将其拖到第一个表的正下方。</p></li><li value="4"><p>单击<span class="uicontrol">“应用”</span>或<span class="uicontrol">“确定”</span>以合并。</p></li></ol><h2 is="heading-item" :level="2" id="使用通配符搜索来合并表-tableau-desktop"><a name="union_wildcard"/>使用通配符搜索来合并表 (Tableau Desktop)</h2><p>使用此方法设置搜索条件以在并集中自动包括表。使用星号 (*) 通配符来匹配 Excel 工作簿和工作表名称、Google 表格工作簿和工作表名称、文本文件名、JSON 文件名、.pdf 文件名以及数据库表名称中的一系列字符或字符模式。</p><p>处理 Excel、文本文件数据、JSON 文件、.pdf 文件数据时,您也可以使用此方法来合并文件夹中的文件以及工作簿中的工作表。搜索范围限定于所选的连接。连接和连接中可用的表显示在“数据源”页面的左侧窗格上。</p><h3 is="heading-item" :level="3" id="使用通配符搜索来合并表">使用通配符搜索来合并表</h3><ol><li value="1"><p>在数据源页面上,双击<span class="uicontrol">“新建并集”</span>以设置并集。</p><p><img src="Img/union_union_new.png" alt=""/></p></li><li value="2"><p>在“并集”对话框中单击<span class="uicontrol">“通配符(自动)”</span>。</p><p><img src="Img/union_pattern_new.png" alt=""/></p></li><li value="3"><p>输入搜索条件,您想让 Tableau 使用此条件查找要包括在并集中的表。</p><p><img src="Img/union_pattern_pattern.png" alt=""/></p><p>例如,您可以在<span class="uicontrol">“包括”</span>文本框中输入 <strong>*2016</strong>,以在 Excel 工作表中合并其名称以“2016”结尾的表。像这样的搜索条件将导致合并选定连接中的 May2016、June2016 和 July2016 表(Excel 工作表)。在本例中,此连接叫做 Sales,所建立的到 Excel 工作簿(包含所需工作表)的连接在 sales 目录内的 quarter_3 文件夹中(例如,Z:\sales\quarter_3)。</p></li><li value="4"><p>单击<span class="uicontrol">“应用”</span>或<span class="uicontrol">“确定”</span>以合并。</p></li></ol><h3 is="heading-item" :level="3" id="扩展搜索以查找更多-excel、文本、json、pdf-数据"><a name="expand"/>扩展搜索以查找更多 Excel、文本、JSON、.pdf 数据</h3><p>最初可用于合并的表的范围局限于您已经选择的连接。如果想要合并位于当前文件夹(适用于 Excel、文本、JSON、.pdf 文件)之外或其他工作簿(适用于 Excel 工作表)中的更多表,请选中“并集”对话框中的一个或两个复选框以扩展搜索。</p><p>例如,假设您想要合并当前文件夹之外 <u>所有</u> 名称以“2016”结尾的 Excel 工作表。则会建立到 Excel 工作簿的初始连接,该工作簿位于以上示例中的相同目录中,即 Z:\sales\quarter_3 中。</p><p><img src="Img/union_pattern_pattern_expand.png" alt=""/></p><ul><li value="1"><p><b>包括:</b> 如果在<span class="uicontrol">“包括”</span>文本框中输入 <b>*2016</b>,并使对话框中的其余搜索条件保持原样,则 Tableau 会在当前文件夹中查找其名称以“2016”结尾的所有 Excel 工作表。</p><p>在下图中,黄色突出显示的项表示当前位置,即一个 Excel 工作簿,您在“quarter_3”中创建了到该工作簿的连接。绿色框表示属于工作簿和工作表且因执行此搜索条件而合并的表。</p><p><img src="Img/union_pattern_default.png" alt=""/></p><p> </p></li><li value="2"><p><b>包括 + 将搜索扩展到子文件夹:</b> 如果在<span class="uicontrol">“包括”</span>文本框中输入 <b>*2016</b>,并选中<span class="uicontrol">“将搜索扩展到子文件夹”</span>复选框,则 Tableau 会执行以下操作:</p><ul><li value="1"><p>在当前文件夹中查找名称以“2016”结尾的所有 Excel 工作表。</p></li><li value="2"><p>查找名称以“2016”结尾且位于“quarter_3”文件夹的子文件夹内 Excel 工作簿中的附加 Excel 工作表。</p></li></ul><p>在下图中,黄色突出显示的项表示当前位置,即一个 Excel 工作簿,您在“quarter_3”文件夹中创建了到该工作簿的连接。绿色框表示属于工作簿和工作表且因执行此搜索条件而合并的表。</p><p><img src="Img/union_pattern_subfolders.png" alt=""/></p><p> </p></li><li value="3"><p><b>包括 + 将搜索扩展到父文件夹:</b>如果在<span class="uicontrol">“包括”</span>文本框中输入 <b>*2016</b>,并选中<span class="uicontrol">“将搜索扩展到父文件夹”</span>复选框,则 Tableau 会执行以下操作:</p><ul><li value="1"><p>例如,在当前文件夹“quarter_3”中查找名称以“2016”结尾的所有 Excel 工作表。</p></li><li value="2"><p>查找名称以“2016”结尾且位于“quarter_3”文件夹的并行文件夹中的附加 Excel 工作表。在本示例中,“quarter_4”为并行文件夹。</p></li></ul><p>在下图中,黄色突出显示的项表示当前位置,即一个 Excel 工作簿,您在“quarter_3”文件夹中创建了到该工作簿的连接。绿色框表示属于工作簿和工作表且因执行此搜索条件而合并的表。</p><p><img src="Img/union_pattern_parent.png" alt=""/></p></li></ul><p> </p><ul><li value="1"><b>包括 + 将搜索扩展到子文件夹 + 将搜索扩展到父文件夹:</b>如果在<span class="uicontrol">“包括”</span>文本框中输入 <b>*2016</b>,并选中<span class="uicontrol">“将搜索扩展到子文件夹”</span>和<span class="uicontrol">“将搜索扩展到父文件夹”</span>复选框,则 Tableau 会执行以下操作:<ul><li value="1"><p>在当前文件夹“quarter_3”中查找名称以“2016”结尾的所有 Excel 工作表。</p></li><li value="2"><p>查找位于当前文件夹“quarter_3”的子文件夹中的附加 Excel 工作簿。</p></li></ul><ul><li value="1"><p>查找位于“quarter_3”文件夹的并行文件夹及其子文件夹中的附加 Excel 工作簿。在本示例中,“quarter_4”为并行文件夹。</p></li></ul><p>在下图中,黄色突出显示的项表示当前位置,即一个 Excel 工作簿,您已创建了到该工作簿的连接。绿色框表示属于工作簿和工作表且因执行此搜索条件而合并的表。</p><p><img src="Img/union_pattern_subfolders_parent.png" alt=""/></p></li></ul><p class="note"><b>注意:</b> 处理 Excel 数据时,通配符搜索包括命名范围,但会排除 Data Interpreter 找到的表。</p><h2 is="heading-item" :level="2" id="重命名、修改或移除并集"><a name="manage"/>重命名、修改或移除并集</h2><p>在“数据源”页面的画布中直接执行基本合并任务。</p><div is="accordion-item"><span slot="title">重命名并集</span><div slot="content"><ol><li value="1"><p>双击包含合并的物理表的逻辑表。</p></li><li value="2"><p>在物理层画布上双击并集表。</p></li><li value="3"><p>输入并集的新名称。</p><p><img src="Img/union_union_rename.png" alt=""/></p></li></ol></div></div><div is="accordion-item"><span slot="title">在并集中添加或移除表</span><div slot="content"><ol><li value="1"><p>双击包含合并的物理表的逻辑表。</p></li><li value="2"><p>单击并集下拉箭头,然后选择<b>“编辑并集”</b>。</p></li><li value="3"><p>您可以从左侧窗格中拖动想要合并的其他表,或者将鼠标悬停在表上,直到显示移除图标为止,然后单击相应的图标以删除此表。</p><p><img src="Img/union_union_customize.png" alt=""/></p></li><li value="4"><p>单击<span class="uicontrol">“应用”</span>或<span class="uicontrol">“确定”</span>以完成任务。</p></li></ol></div></div><div is="accordion-item"><span slot="title">移除并集</span><div slot="content"><ul><li value="1"><p>双击包含合并的物理表的逻辑表,然后单击并集下拉箭头并选择<b>“移除”</b>。 </p><p><img src="Img/union_union_remove.png" alt=""/></p></li></ul></div></div><h2 is="heading-item" :level="2" id="匹配字段名称或字段排序"><a name="matching"/>匹配字段名称或字段排序</h2><p>并集中的表通过匹配字段名称来合并。处理 Excel、Google 表格、文本文件、JSON 文件或 .pdf 文件数据时,如果没有匹配的字段名称(或者您的表不包含列标题),则可以指示 Tableau 根据基础数据中字段的顺序来合并表,方法是创建并集,然后从并集下拉菜单中选择<b>“自动生成字段名称”</b>选项。</p><p><img src="Img/union_union_generatefieldnames.png" alt=""/></p><h2 is="heading-item" :level="2" id="关于并集的元数据"><a name="metadata"/>关于并集的元数据</h2><p>创建并集后,会生成关于并集的附加字段,并将其添加到网格中。新字段提供关于并集中原始值的来源的信息,包括工作表和表名称。在工作表或表名称中嵌入对分析至关重要的独特信息时,这些字段很有用。</p><p>例如,上面示例中所使用的表在表名称而不是数据本身中存储了独有的月份和年份信息。在此情况下,您可以使用并集生成的<span class="uicontrol">“表名称”</span>字段访问此信息,并在分析中使用它。</p><p><img src="Img/union_metadata.png" alt=""/></p><p>如果并集中使用了命名范围,则<b>“工作表”</b>字段下会显示空值。</p><p class="note"><b>注意:</b> 您可以使用并集生成的字段(例如<b>“工作表”</b>或<b>“表名称”</b>)作为联接键。您可以将联接中的合并表与另一个表或合并表配合使用。</p><h2 is="heading-item" :level="2" id="在并集中合并不匹配的字段"><a name="merge"/>在并集中合并不匹配的字段</h2><p>当并集中的字段名称不匹配时,并集中的字段包含 Null 值。您可以使用合并选项将非匹配字段合并成单个字段以移除 Null 值。使用合并选项时,原始字段会被替换为新字段,新字段将显示非匹配字段中每一行的第一个非 Null 值。</p><p>您也可以创建自己的计算,或者修改基础数据以合并非匹配字段(如有可能)。</p><p>例如,假定将第四个表“August2016”添加至基础数据。该表将不包含标准“Customers”字段名称,而是包含名为“Cust.”的缩写版本。</p><table><tbody><tr><td><b>August2016</b><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">Cust.</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1">类型</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Maria</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">9</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Kathy</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">贷记</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">18</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">Vijay</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1">现金</td></tr></tbody></table></td></tr></tbody></table><p>这些表的并集会创建一个表,其中包含表中具有一些空值的所有行。可以使用合并选项将相关的客户字段合并为单个字段。</p><table><tbody><tr><td><p><b>并集</b>(具有空值)</p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1" style="background-color: #b4c8b3;">客户</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">类型</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1" style="background-color: #b4c8b3;">Cust.</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Lane</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">5</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">10</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Chris</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">6</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Juan</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">空</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Lisa</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">3</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Isaac</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Sam</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Mario</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">15</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Wei</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">21</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">Jim</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">null</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b4c8b3;">null</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Maria</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">9</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1" style="background-color: #b4c8b3;">null</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1">Kathy</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">18</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1" style="background-color: #b4c8b3;">null</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1">Vijay</td></tr></tbody></table></td><td><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p><img src="Img/union_arrow.png" alt=""/></p></td><td><p>(包含已合并的列的)<b>并集</b></p><table class="table--plain"><thead><tr class="TableStyle-Basic-Border-Head-Header1"><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">日</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">采购</th><th class="TableStyle-Basic-Border-HeadE-Column1-Header1">类型</th><th class="TableStyle-Basic-Border-HeadD-Column1-Header1" style="background-color: #b4c8b3;">Customer, Cust.</th></tr></thead><tbody><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">5</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Lane</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">10</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">6</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Chris</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Juan</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">3</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Lisa</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">4</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Isaac</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">28</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Sam</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Mario</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">15</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Wei</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">21</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Jim</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">2</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Maria</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">9</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">1</td><td class="TableStyle-Basic-Border-BodyE-Column1-Body1">贷记</td><td class="TableStyle-Basic-Border-BodyD-Column1-Body1" style="background-color: #b4c8b3;">Kathy</td></tr><tr class="TableStyle-Basic-Border-Body-Body1"><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">18</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">7</td><td class="TableStyle-Basic-Border-BodyB-Column1-Body1">现金</td><td class="TableStyle-Basic-Border-BodyA-Column1-Body1" style="background-color: #b4c8b3;">Vijay</td></tr></tbody></table></td></tr></tbody></table><p>合并字段后,您可以在转置中使用通过合并生成的字段,或者拆分字段或将字段用作联接键。您还可以更改通过合并生成的字段的数据类型。</p><div is="accordion-item"><span slot="title">合并不匹配的字段</span><div slot="content"><p/><ol><li value="1"><p>选择网格中的两个或更多个列。</p></li><li value="2"><p>单击列下拉箭头,然后选择<b>“合并不匹配的字段”</b>。</p></li></ol></div></div><div is="accordion-item"><span slot="title">移除合并</span><div slot="content"><ul><li value="1">单击合并字段的列下拉箭头,然后选择<b>“移除合并”</b>。</li></ul></div></div><h2 is="heading-item" :level="2" id="总览:使用并集"><a name="glance"/>总览:使用并集</h2><h3 is="heading-item" :level="3" id="tableau-desktop-和-web-制作(tableau-cloud-和-tableau-server)"><a name="Tableau"/>Tableau Desktop 和 Web 制作(Tableau Cloud 和 Tableau Server)</h3><ul><li value="1"><p>合并表可在联接中使用。</p></li><li value="2"><p>合并表可在与另一个合并表的联接中使用。</p></li><li value="3"><p>并集生成的字段(<span class="uicontrol">“工作表”</span>和<span class="uicontrol">“表名称”</span>)可用作联接键。</p></li><li value="4"><p>如果并集中使用了命名范围,则<span class="uicontrol">“工作表”</span>字段下会显示空值。</p></li><li value="5"><p>通过合并生成的字段可在转置中使用。</p></li><li value="6"><p>通过合并生成的字段可用作联接键。</p></li><li value="7"><p>可以更改通过合并生成的字段的数据类型。</p></li><li value="8"><p>合并相同连接内的表。即,您不能合并不同数据库中的表。</p></li></ul><h3 is="heading-item" :level="3" id="仅限-tableau-desktop"><a name="Tableau2"/>仅限 Tableau Desktop</h3><ul><li value="1"><p>处理 Excel 数据时,通配符搜索包括命名范围,但会排除 Data Interpreter 找到的表。</p></li><li value="2"><p>通过合并生成的字段可在转置或拆分中使用。</p></li><li value="3"><p>若要合并 JSON 文件,它必须具有 .json、.txt 或 .log 扩展名。有关处理 JSON 数据的更多信息,请参阅<a href="examples_json.htm" class="MCXref xref">JSON 文件</a>。</p></li><li value="4"/><li value="1"><p>使用通配符搜索来合并 .pdf 文件中的表时,合并结果的范围限定于在所连接到的初始 .pdf 文件中扫描的页面。有关处理 .pdf 文件中的数据的详细信息,请参见 <a href="examples_pdf.htm" class="MCXref xref">PDF 文件</a>。</p></li><li value="5"><p>无法合并存储过程。</p></li><li value="6"><p>处理数据库数据时,您可以将并集转换为自定义 SQL。</p></li></ul></div></div><div class="article__footer--back-to-top text--centered print-hidden quick-help-hidden"><a href="#" class="text--caps"><span class="icon--med icon--arrow-up"/> 回到顶部</a></div><feedback-form :disabled="false" class="print-hidden content-only-hidden" helpful-question="此内容是否有帮助?" helpful-yes="是" helpful-no="否" comment-question="我们重视您的反馈。在此处添加注释。" submit-option="发送" cancel-option="取消" loading-text="正在发送..."><span slot="submittedMessage">感谢您的反馈!</span></feedback-form></article><nav class="nav-side nav-side--right"><menu-heading-links-scrollable-help menu-title="本文内容" :disabled="false" :headings="pageHeadings"/></nav></div></div><feedback-button-floating tooltip="发送反馈" :disabled="false"/><footer class="container--full-width"><div class="container--centered"><div class="footer__links text--caps"><ul><li><a href="https://www.tableau.com/zh-cn/legal" class="">法律</a></li><li><a id="privacyLink" class="">隐私</a></li><li><a href="#" data-ignore-geolocation="true" class="optanon-toggle-display">Cookie Preferences</a></li></ul></div><div class="footer__copyright text--caps">© 2003-2022 Tableau Software LLC.保留所有权利</div></div></footer></div> </body>
推荐文章
腼腆的卡布奇诺
·
Data Types - Tableau
3 周前
道上混的滑板
·
关于python实现CRC32的应用和总结_51CTO博客_python crc
1 月前
自信的抽屉
·
MultipartFile会不会导致内存泄露_multipartfile需要关闭吗_fengfeng0529的博客-CSDN博客
1 年前
机灵的鸵鸟
·
ChatGPT是“虚火”还是颠覆性技术革命?_手机新浪网
1 年前
有情有义的蟠桃
·
NEWSEQUENTIALID (Transact-SQL) - SQL Server | Microsoft Learn
1 年前
失恋的柿子
·
DBeaver for Mac(数据库管理) - 知乎
1 年前